private void FocusChanged(bool hasFocus)
{
// The OnGotFocus & OnLostFocus are asynchronously and cannot
// reliably tell you that have the focus. All they do is let you
// know that the focus changed sometime in the past. To determine
// if you currently have the focus you need to do consult the
// FocusManager (see HasFocus()).
if(hasFocus)
{
if(TextBox != null && TextBox.SelectionLength == 0)
{
TextBox.SelectAll();
}
}
else
{
IsDropDownOpen = false;
_userCalledPopulate = false;
if(TextBox != null)
{
TextBox.Select(TextBox.Text.Length, 0);
}
}
}