public TVCustomerViewModel(TVCustomerModel parentcustomer) : base(null, true) { Customer = parentcustomer; IsExpanded = false; IsSelected = false; CheckBoxVisibility = Visibility.Collapsed; }
/// <summary> /// Add new Customer Node to treeview /// </summary> /// <param name="customer">CustomerModel</param> public static void AddCustomerNode(TVCustomerModel customer) { Window owner = Application.Current.Windows[0]; FullyObservableCollection <TVCustomerViewModel> customers = (owner.DataContext as AssetTreeExViewModel).allcustomers; customers.Add(new TVCustomerViewModel(customer)); }
/// <summary> /// Filter customers /// </summary> /// <param name="customerID"></param> private void GetCustomers(int customerID) //Proc that starts process of building data structure for treeview { //First stage is to build parent nodes which are the Customer nodes Customers.Clear(); if (customerID == 0) { Customers = allcustomers; } else { TVCustomerModel q = (from a in customers where a.ID == customerID select a).FirstOrDefault(); Customers.Add(new TVCustomerViewModel(q)); } }