private bool CanDelete( int startPosition, int selectionLength, bool deleteForward, MaskedTextProvider provider )
{
if( this.IsReadOnly )
return false;
if( selectionLength == 0 )
{
if( !deleteForward )
{
if( startPosition == 0 )
return false;
startPosition--;
}
else if( ( startPosition + selectionLength ) == provider.Length )
{
return false;
}
}
MaskedTextResultHint notUsed;
int tentativeCaretPosition = startPosition;
int endPosition = ( selectionLength > 0 ) ? ( ( startPosition + selectionLength ) - 1 ) : startPosition;
bool success = provider.RemoveAt( startPosition, endPosition, out tentativeCaretPosition, out notUsed );
return success;
}