@@ -85,6 +85,8 @@ public AdvancedEntry()
8585
8686 txtInput . TextChanged += TxtInput_TextChanged ;
8787 txtInput . Completed += ( s , args ) => { ExecuteCommand ( ) ; Completed ? . Invoke ( this , new EventArgs ( ) ) ; FocusNext ( ) ; } ;
88+ txtInput . Focused += ( s , args ) => { var arg = new FocusEventArgs ( this , true ) ; FocusedCommand ? . Execute ( arg ) ; Focused ? . Invoke ( this , arg ) ; } ;
89+ txtInput . Unfocused += ( s , args ) => { var arg = new FocusEventArgs ( this , false ) ; UnfocusedCommand ? . Execute ( arg ) ; Unfocused ? . Invoke ( this , arg ) ; } ;
8890 imgWarning . IsVisible = this . IsRequired ;
8991 Reset ( ) ;
9092 }
@@ -107,6 +109,8 @@ public AdvancedEntry()
107109 public event EventHandler < TextChangedEventArgs > TextChanged ;
108110 public event EventHandler Clicked ;
109111 public event EventHandler ValidationChanged ;
112+ public new event EventHandler < FocusEventArgs > Unfocused ;
113+ public new event EventHandler < FocusEventArgs > Focused ;
110114 #endregion
111115 #region Properties
112116 ///------------------------------------------------------------------------
@@ -374,6 +378,16 @@ public string ValidationMessage
374378 public ICommand CompletedCommand { get ; set ; }
375379 ///----------------------------------------- -------------------------------
376380 /// <summary>
381+ /// Executed when entry focused.
382+ /// </summary>
383+ public Command < FocusEventArgs > FocusedCommand { get ; set ; }
384+ ///----------------------------------------- -------------------------------
385+ /// <summary>
386+ /// Executed when entry unfocused.
387+ /// </summary>
388+ public Command < FocusEventArgs > UnfocusedCommand { get ; set ; }
389+ ///----------------------------------------- -------------------------------
390+ /// <summary>
377391 /// Parameter to send with CompletedCommand
378392 /// </summary>
379393 public object CommandParameter { get => GetValue ( CommandParameterProperty ) ; set => SetValue ( CommandParameterProperty , value ) ; }
@@ -462,17 +476,18 @@ void ExecuteCommand()
462476 /// </summary>
463477 public virtual new void Focus ( )
464478 {
465- base . Focus ( ) ; // To trigger base.Focused event
479+ Focused ? . Invoke ( this , new FocusEventArgs ( this , true ) ) ;
466480 txtInput . Focus ( ) ;
467481 }
468482 /// <summary>
469483 /// Onfocus from this entry and hides keyboard.
470484 /// </summary>
471485 public virtual new void Unfocus ( )
472486 {
473- base . Unfocus ( ) ; // To trigger base.Unfocused event
487+ Focused ? . Invoke ( this , new FocusEventArgs ( this , true ) ) ;
474488 txtInput . Unfocus ( ) ;
475489 }
490+
476491 /// <summary>
477492 /// Automaticly finds next Advanced entry and focus it.
478493 /// </summary>
0 commit comments