File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,29 @@ public class TimePicker : Control
32
32
static TimePicker ( )
33
33
{
34
34
DefaultStyleKeyProperty . OverrideMetadata ( typeof ( TimePicker ) , new FrameworkPropertyMetadata ( typeof ( TimePicker ) ) ) ;
35
+ EventManager . RegisterClassHandler ( typeof ( TimePicker ) , UIElement . GotFocusEvent , new RoutedEventHandler ( OnGotFocus ) ) ;
36
+ }
37
+
38
+ /// <summary>
39
+ /// Called when this element gets focus.
40
+ /// </summary>
41
+ private static void OnGotFocus ( object sender , RoutedEventArgs e )
42
+ {
43
+ // When TimePicker gets focus move it to the TextBox
44
+ TimePicker picker = ( TimePicker ) sender ;
45
+ if ( ( ! e . Handled ) && ( picker . _textBox != null ) )
46
+ {
47
+ if ( e . OriginalSource == picker )
48
+ {
49
+ picker . _textBox . Focus ( ) ;
50
+ e . Handled = true ;
51
+ }
52
+ else if ( e . OriginalSource == picker . _textBox )
53
+ {
54
+ picker . _textBox . SelectAll ( ) ;
55
+ e . Handled = true ;
56
+ }
57
+ }
35
58
}
36
59
37
60
public TimePicker ( )
You can’t perform that action at this time.
0 commit comments