using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; using Presence.Desktop.ViewModels; using ReactiveUI; using System.Linq; namespace Presence.Desktop.Views; public partial class PresenceView : ReactiveUserControl { public PresenceView() { this.WhenActivated(disposables => { }); AvaloniaXamlLoader.Load(this); } private void OnDataGridSelectionChanged(object sender, SelectionChangedEventArgs e) { if (this.DataContext is PresenceViewModel viewModel) { // Обновляем выделенные элементы в ViewModel viewModel.SelectedItems.Clear(); foreach (var item in e.AddedItems.OfType()) { viewModel.SelectedItems.Add(item); } } } }