port from perforce
This commit is contained in:
30
intromat/Intromat/Views/Editors/StringValueEditorView.cs
Normal file
30
intromat/Intromat/Views/Editors/StringValueEditorView.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Intromat.ViewModels.Editors;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Intromat.Views.Editors
|
||||
{
|
||||
[TemplatePart(Name = nameof(_textBoxValue), Type = typeof(TextBox))]
|
||||
public class StringValueEditorView : EditorViewBase<StringValueEditorViewModel>
|
||||
{
|
||||
private TextBox _textBoxValue = null!;
|
||||
|
||||
public StringValueEditorView()
|
||||
{
|
||||
DefaultStyleKey = typeof(StringValueEditorView);
|
||||
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
this.Bind(ViewModel, vm => vm.Value, v => v._textBoxValue.Text).DisposeWith(d);
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
_textBoxValue = (TextBox)GetTemplateChild(nameof(_textBoxValue))!;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user