private void InitializeComponent() { AvaloniaXamlLoader.Load(this); var textBox = this.FindControl <TextBox>("PasswordControl"); this.PropertyChanged += (s, e) => { if (e.Property == Control.DataContextProperty) { PasswordControlViewModel dataContext = (PasswordControlViewModel)e.NewValue; textBox.GetObservable(TextBox.SelectionStartProperty).Subscribe(position => { if (dataContext != null) { dataContext.SelectionStart = position; } }); textBox.GetObservable(TextBox.SelectionEndProperty).Subscribe(position => { if (dataContext != null) { dataContext.SelectionEnd = position; } }); } }; }
public CreateDerivedKeyPasswordViewModel() { PasswordVM = new PasswordControlViewModel(PasswordChanged, "Password..."); PasswordConfirmationVM = new PasswordControlViewModel(PasswordChanged, "Password confirmation..."); }
public WriteDerivedKeyPasswordViewModel() { PasswordVM = new PasswordControlViewModel(placeholder: "Password..."); }