internal void removeChild(enumValue value) { valList.Children.Remove(value); if (valList.Children.Count == 1) { (valList.Children[0] as enumValue).removeBtn.Visibility = Visibility.Collapsed; } }
private void addVal_Click(object sender, RoutedEventArgs e) { var evalue = new enumValue("", this); valList.Children.Add(evalue); (valList.Children[0] as enumValue).removeBtn.Visibility = Visibility.Visible; //https://stackoverflow.com/a/56289573 Application.Current.Dispatcher.BeginInvoke(new Action(() => { evalue.valueName.Focus(); }), System.Windows.Threading.DispatcherPriority.Render); evalue.valueName.SelectAll(); }