port from perforce
This commit is contained in:
41
intromat/Intromat/Views/UndoRedoView.xaml.cs
Normal file
41
intromat/Intromat/Views/UndoRedoView.xaml.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user