private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { DependencyObject parent = VisualTreeHelper.GetParent(e.OriginalSource as Button); while (!(parent is ListBoxItem)) { parent = VisualTreeHelper.GetParent(parent); } if (parent != null) { SelectedAccount = ((ListBoxItem)parent).Content as LBSource; } }
void Button_Search_Click(object sender, RoutedEventArgs e) { listboxView.Filter = (item) => { LBSource IItem = item as LBSource; if (IItem.AccountName.Contains(TextBox_Search.Text.Trim())) { return(true); } else { return(false); } }; }
private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { DependencyObject parent = VisualTreeHelper.GetParent(e.OriginalSource as Button); while (!(parent is ListBoxItem)) { parent = VisualTreeHelper.GetParent(parent); } if (parent != null) SelectedAccount = ((ListBoxItem) parent).Content as LBSource; }
void AccountBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { SelectedAccount = AccountBox.SelectedItem as LBSource; }
void AccountBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { SelectedAccount = AccountBox.SelectedItem as LBSource; }