示例#1
0
文件: Window1.xaml.cs 项目: Ossir/WPF
 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();
         }
 }
示例#2
0
文件: Window1.xaml.cs 项目: Ossir/WPF
 private void GridFocusEvent(object sender, EventArgs e)
 {
     selTB = null;
     selDPB = null;
     selGrid = (Grid)sender;
     selGrid.Focus();
 }