Files
bluflame/intromat/Intromat/Views/UndoRedoView.xaml.cs
2026-04-18 22:31:51 +02:00

41 lines
1.3 KiB
C#

using System.Diagnostics;
using System.Reactive.Disposables;
using System.Windows;
using Intromat.ViewModels;
using ReactiveUI;
namespace Intromat.Views
{
/// <summary>
/// Interaction logic for UndoRedoView.xaml
/// </summary>
public partial class UndoRedoView : IViewFor<UndoRedoViewModel>
{
public static readonly DependencyProperty ViewModelProperty = DependencyProperty.Register(nameof(ViewModel),
typeof(UndoRedoViewModel), typeof(UndoRedoView), new PropertyMetadata(null));
public UndoRedoView()
{
InitializeComponent();
this.WhenActivated(d =>
{
Debug.Assert(ViewModel != null, nameof(ViewModel) + " != null");
this.BindCommand(ViewModel, vm => vm.UndoCommand, v => v.undoButton).DisposeWith(d);
this.BindCommand(ViewModel, vm => vm.RedoCommand, v => v.redoButton).DisposeWith(d);
});
}
public UndoRedoViewModel? ViewModel
{
get => (UndoRedoViewModel?)GetValue(ViewModelProperty);
set => SetValue(ViewModelProperty, value);
}
object? IViewFor.ViewModel
{
get => ViewModel;
set => ViewModel = (UndoRedoViewModel?)value;
}
}
}