private void SearchButton2_Click(object sender, RoutedEventArgs e) { string value = AutoCompleteUsers.Text; CxListBoxItem FocusItem = null; if (SearchElementOptions(value) != null) { FocusItem = SearchElementUsers(value); } else { MessageBox.Show("did not match any documents."); return; } ListBoxItem lbi = (ListBoxItem)ListBoxUsers .ItemContainerGenerator .ContainerFromItem(FocusItem); try { lbi.Focus(); SelectedUser = FocusItem; FocusItem.Selected = true; } catch (NullReferenceException) { MessageBox.Show("Dosen't Exist"); } }
public Users(string user, ImageSource image, int i) : base() { _user = user; _image = image; index = i; CxListBoxItem = new CxListBoxItem() { Icon = image, Label = user, OpionsOrUsers = false }; }
public Options(string option, Brush color, Brush background, int i) : base() { _option = option; _colorText = color; _background = background; index = i; CxListBoxItem = new CxListBoxItem() { Icon = null, Label = _option, ColorText = _colorText, OpionsOrUsers = true }; }