コード例 #1
0
        public void Open(VendorSearchCallback callback)
        {
            if (popVendorSearch.IsOpen)
            {
                return;                   //because we want to pop this open via both keyboard focus and click, it could be double fired
            }
            popVendorSearch.IsOpen = true;

            //save keyboard focus so we can restore when closing
            _prePopupFocusedElement = Keyboard.FocusedElement;

            _cb = callback;

            if (lbxVendorList.Items.Count == 0) //only force focus to input box if we haven't been here already this session
            {
                txtVendorName.Focus();
            }
            else if (lbxVendorList.SelectedItem != null)
            {
                ((ListBoxItem)lbxVendorList.ItemContainerGenerator.ContainerFromIndex(lbxVendorList.SelectedIndex)).Focus();
            }
            else
            {
                lbxVendorList.Focus();
            }
        }
コード例 #2
0
    public void Open(VendorSearchCallback callback)
    {
      if (popVendorSearch.IsOpen) return; //because we want to pop this open via both keyboard focus and click, it could be double fired
      popVendorSearch.IsOpen = true;

      //save keyboard focus so we can restore when closing
      _prePopupFocusedElement = Keyboard.FocusedElement;

      _cb = callback;

      if (lbxVendorList.Items.Count == 0) //only force focus to input box if we haven't been here already this session
        txtVendorName.Focus();
      else if (lbxVendorList.SelectedItem != null)
        ((ListBoxItem)lbxVendorList.ItemContainerGenerator.ContainerFromIndex(lbxVendorList.SelectedIndex)).Focus();
      else lbxVendorList.Focus();
    }