Issue with focus of a Silverlight Listbox

Posted by Malcolm on Stack Overflow See other posts from Stack Overflow or by Malcolm
Published on 2010-05-05T14:13:48Z Indexed on 2010/05/05 14:18 UTC
Read the original article Hit count: 278

Filed under:
|

I have a button and on click of that i show a popup which has a listbox.

popup named - popComboList

Listbox named - lstComboBoxResult

I am giving a focus to a listbox but at initial on a click of a button the listbox doesn't get focus-(this happens only once at initial, when i first time click button) After the second click it works.

 private void bnOpen_Click(object sender, RoutedEventArgs e)
    {
        if (IsDesignTime)
            return;

        lstComboBoxResult.Width = tbComboValue.ActualWidth + bnOpen.ActualWidth;
        if (!popComboList.IsOpen)
        {
            SetPopupPosition(popComboList);
            popComboList.IsOpen = true;
            lstComboBoxResult.Focus();
        }
        else
        {
            popComboList.IsOpen = false;
        }
    }

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about c#