Wednesday, 15 September 2010

wpf - How to clear selected items collection -


I have a WPF application with two combo box select hereby

  public string selected application (set (if (select option == value) return;  This._selectedApplication = value; InitializeTransactionTypes (),;} get {return ..selectedApplication;}}   

Here I have two comboboxes to fill the second item which is checking the match ID

  ObservableCollection. & Lt ; TransactionTypeViewModel & gt; _transTypeObsList = New Vary Kshniy Compilation & lt; TransactionTypeViewModel & gt; (); private void InitializeTransactionTypes () {if (! _selectedApplication = NULL) {var getAppCode = ApplicationVModel.GetAllApplications () .FirstOrDefault (app = & gt; apps.Name == _selectedApplication); var transTypeList = TransactionTypeVModel.GetAllViewModelTransTypes () .Where (T = & gt ;! getAppCode = null & amp; & amp; t.Id == getAppCode.Id); transaction type = new Nirikshniy compilation & lt; TransactionTypeViewModel & gt; (TransTypeList); NotifyPropertyChanged ("TransactionTypes"); }}   

More information about methods:

List of VMs is a list of

  public list & lt Mapped; TransactionTypeViewModel & gt; . Select GetAllViewModelTransTypes () {TransactionTypeViewModels = TransactionTypeModel.GetAllTransactionTypes () or (transType = & gt; New TransactionTypeViewModel {id = transType.Id, Name = transType.Name,}) .ToList (); See Return Transaction Type Models; Let's say I select the first combobox (A, B, C, D) ... and in the second Combobox {A'1, A2, A3} When I select the item from the first combo box, I keep popping the second cubes, I just wanted to show {A'1 for A} {B'1 for B} ... but now what does it do? For '1 A'1 A'1 ..... A} {B' for 1 B1 B1 .... B} for each selection  

I clear the previous selection I want to choose from Doors would like to display a new menu. Thank you

New to compile comments, instead of creating new ObsavableCollection Some changes are already by you and it will inform the UI about the change. Your Arnbikarnsnsadn type should look something like this:

  private void Prarnbikarnsnsadn type () (if (selected app! = NULL) {var getAppCode = ApplicationVModel.GetAllApplications (). FirstOrDefault (Apps = & gt; apps.Name == selected application); transactionTypes.Clear (); where (T = & foreach (TransactionTypeVModel.GetAllViewModelTransTypes bridesmaid TransactionItem (at) gt ;. getAppCode = null & amp; ! & Amp; t.Id == getAppCode.Id)) transactionTypes.Add (transactionItem);}}   

and in this way you transaction Need not be informed about

No comments:

Post a Comment