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