private bool MoveFocusLeft()
{
if( this.FlowDirection == FlowDirection.LeftToRight )
{
//occurs only if the cursor is at the beginning of the text
if( ( this.CaretIndex == 0 ) && ( this.SelectionLength == 0 ) )
{
if( ComponentCommands.MoveFocusBack.CanExecute( null, this ) )
{
ComponentCommands.MoveFocusBack.Execute( null, this );
return true;
}
else if( this.CanMoveFocus( FocusNavigationDirection.Left, false ) )
{
this.MoveFocus( new TraversalRequest( FocusNavigationDirection.Left ) );
return true;
}
}
}
else
{
//occurs only if the cursor is at the end of the text
if( ( this.CaretIndex == this.Text.Length ) && ( this.SelectionLength == 0 ) )
{
if( ComponentCommands.MoveFocusBack.CanExecute( null, this ) )
{
ComponentCommands.MoveFocusBack.Execute( null, this );
return true;
}
else if( this.CanMoveFocus( FocusNavigationDirection.Left, false ) )
{
this.MoveFocus( new TraversalRequest( FocusNavigationDirection.Left ) );
return true;
}
}
}
return false;
}