public void PreencheCombo(bool setSelectedItem = true) { if (!_hasToBeLoadedAgain) { return; } List <SomeHierarchyViewModel> l = GIComboTreeUtils.ReturnTree(TabG); if (l.Count > 0) { this.ItemsSource = l; //AllItems = new ObservableCollection<SomeHierarchyViewModel>(l); //SetCurrentValue(AllItemsProperty, new ObservableCollection<SomeHierarchyViewModel>(l)); if (setSelectedItem) { CodInt = 0; } //SomeHierarchyViewModel sh = (SomeHierarchyViewModel)SelectedItem; //if (sh == null) // SetSelectedItem(Items[0]); //else // SetSelectedItem(sh); _hasToBeLoadedAgain = false; } }
public ComboTreeGenericVM(int tabg) { //Items = new List<SomeHierarchyViewModel>(); //MontaTree(tabg); Items = GIComboTreeUtils.ReturnTree(tabg); if (Items.Count > 0) { this.SelectedItem = this.Items[0]; } }