private static void IsFocusedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var fe = (FrameworkElement)d; if (e.OldValue == null) { fe.GotFocus += FrameworkElement_GotFocus; fe.LostFocus += FrameworkElement_LostFocus; } if (!fe.IsVisible) { fe.IsVisibleChanged += new DependencyPropertyChangedEventHandler(fe_IsVisibleChanged); } if ((bool)e.NewValue) { ProcessDesigner.UserControls.ComboBoxCus combo = fe as ProcessDesigner.UserControls.ComboBoxCus; ProcessDesigner.UserControls.ComboBoxWithSearch combosearch = fe as ProcessDesigner.UserControls.ComboBoxWithSearch; ProcessDesigner.UserControls.DatePickerCus datepic = fe as ProcessDesigner.UserControls.DatePickerCus; if (combo != null) { ((System.Windows.Controls.TextBox)combo.FindName("txtCombobox")).Focus(); } else if (combosearch != null) { ((System.Windows.Controls.TextBox)combosearch.FindName("txtCombobox")).Focus(); } else if (datepic != null) { ((System.Windows.Controls.TextBox)datepic.FindName("txtDate")).Focus(); } else { fe.Focus(); } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.CusDatePicker = ((ProcessDesigner.UserControls.DatePickerCus)(target)); #line 8 "..\..\DatePickerCus.xaml" this.CusDatePicker.Loaded += new System.Windows.RoutedEventHandler(this.CusDatePicker_Loaded); #line default #line hidden return; case 2: this.txtDate = ((System.Windows.Controls.TextBox)(target)); #line 14 "..\..\DatePickerCus.xaml" this.txtDate.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.txtDate_PreviewKeyDown); #line default #line hidden #line 14 "..\..\DatePickerCus.xaml" this.txtDate.PreviewLostKeyboardFocus += new System.Windows.Input.KeyboardFocusChangedEventHandler(this.txtDate_PreviewLostKeyboardFocus); #line default #line hidden #line 14 "..\..\DatePickerCus.xaml" this.txtDate.PreviewTextInput += new System.Windows.Input.TextCompositionEventHandler(this.txtDate_PreviewTextInput); #line default #line hidden #line 15 "..\..\DatePickerCus.xaml" this.txtDate.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txtDate_TextChanged); #line default #line hidden return; case 3: this.ErrorTemp = ((System.Windows.Controls.Canvas)(target)); return; case 4: this.togDate = ((System.Windows.Controls.Primitives.ToggleButton)(target)); return; case 5: this.popContent = ((System.Windows.Controls.Primitives.Popup)(target)); #line 45 "..\..\DatePickerCus.xaml" this.popContent.Opened += new System.EventHandler(this.popContent_Opened); #line default #line hidden #line 45 "..\..\DatePickerCus.xaml" this.popContent.Closed += new System.EventHandler(this.popContent_Closed); #line default #line hidden return; case 6: this.bdrContent = ((System.Windows.Controls.Border)(target)); return; case 7: this.calForDate = ((System.Windows.Controls.Calendar)(target)); #line 53 "..\..\DatePickerCus.xaml" this.calForDate.SelectedDatesChanged += new System.EventHandler <System.Windows.Controls.SelectionChangedEventArgs>(this.calForDate_SelectedDatesChanged); #line default #line hidden return; case 8: this.btnToday = ((System.Windows.Controls.Button)(target)); #line 54 "..\..\DatePickerCus.xaml" this.btnToday.Click += new System.Windows.RoutedEventHandler(this.btnToday_Click); #line default #line hidden return; } this._contentLoaded = true; }