public Edit(Output output) { InitializeComponent(); foreach (string fileNameReplacement in AttributeHelper.GetAttributeReplacements()) { MenuItem item = new MenuItem(); item.Header = new TextBlock() { Text = fileNameReplacement }; item.Tag = fileNameReplacement; item.Click += FileNameReplacementItem_Click; FileNameReplacementList.Items.Add(item); } NameTextBox.Text = output.Name; AccountNameTextBox.Text = output.AccountName; UserNameTextBox.Text = output.UserName; PasswordBox.Password = output.Password; FileNameTextBox.Text = output.FileName; FileFormatComboBox.ItemsSource = FileHelper.GetFileFormats(); FileFormatComboBox.SelectedValue = output.FileFormatID; OpenItemInBrowserCheckBox.IsChecked = output.OpenItemInBrowser; NameTextBox.TextChanged += ValidateData; AccountNameTextBox.TextChanged += ValidateData; FileFormatComboBox.SelectionChanged += ValidateData; ValidateData(null, null); AccountNameTextBox.Focus(); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(AccountNameTextBox.Text)) { AccountNameTextBox.SelectAll(); } AccountNameTextBox.Focus(FocusState.Keyboard); }