private void TBFocusEvent(object sender, EventArgs e) { FrameworkElement element = sender as FrameworkElement; var par = element.Parent as UIElement; selGrid = null; selDPB = null; selTB = (TextBox)sender; selTB.Focus(); selTB.BorderThickness = new Thickness(1); var control = sender as UIElement; if (control != null && control.GetType() == typeof(TextBox) && par.GetType() != typeof(Grid)) { selCanv.Children.Remove(control); selCanv.Children.Add(control); }else if (control != null && control.GetType() == typeof(TextBox) && par.GetType() == typeof(Grid)) { selGrid = (Grid)par; selGrid.Focus(); } }
private void GridFocusEvent(object sender, EventArgs e) { selTB = null; selDPB = null; selGrid = (Grid)sender; selGrid.Focus(); }