public ListDrive() { InitializeComponent(); DataContext = new DriverViewModel(); DriverViewModel driverViewModel = new DriverViewModel(); count.Content = driverViewModel.CountObject(); }
private void TextBox_SelectionChanged(object sender, RoutedEventArgs e) { DataContext = new DriverViewModel(); var list = new List <Drivers>(); foreach (Drivers driver in ddt.Items) { if (driver.Name.Contains(DriverName.Text)) { list.Add(driver); } } DataContext = new DriverViewModel(list); count.Content = list.Count; }