port from perforce
This commit is contained in:
38
intromat/Intromat/Views/GroupSubnetIONodeView.xaml.cs
Normal file
38
intromat/Intromat/Views/GroupSubnetIONodeView.xaml.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using Intromat.ViewModels.Nodes;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Intromat.Views
|
||||
{
|
||||
public partial class GroupSubnetIONodeView : IViewFor<GroupSubnetIONodeViewModel>
|
||||
{
|
||||
public static readonly DependencyProperty ViewModelProperty = DependencyProperty.Register(nameof(ViewModel),
|
||||
typeof(GroupSubnetIONodeViewModel), typeof(GroupSubnetIONodeView), new PropertyMetadata(null));
|
||||
|
||||
public GroupSubnetIONodeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
NodeView.ViewModel = ViewModel;
|
||||
Disposable.Create(() => NodeView.ViewModel = null).DisposeWith(d);
|
||||
|
||||
this.OneWayBind(ViewModel, vm => vm.NodeType, v => v.NodeView.Background, CodeGenNodeView.ConvertNodeTypeToBrush).DisposeWith(d);
|
||||
});
|
||||
}
|
||||
|
||||
public GroupSubnetIONodeViewModel? ViewModel
|
||||
{
|
||||
get => (GroupSubnetIONodeViewModel?)GetValue(ViewModelProperty);
|
||||
set => SetValue(ViewModelProperty, value);
|
||||
}
|
||||
|
||||
object? IViewFor.ViewModel
|
||||
{
|
||||
get => ViewModel;
|
||||
set => ViewModel = (GroupSubnetIONodeViewModel?)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user