41 lines
1.3 KiB
C#
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;
|
|
}
|
|
}
|
|
} |