presence/Presence.Desktop/Views/PresenceView.axaml.cs

31 lines
892 B
C#
Raw Normal View History

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