This question is locked. New answers and comments are not allowed.
Hi to all,
I'll go directly to the problem... I am creating a treeView in the go from a flat list, i create one RadTreeVieIitem and if the item have child i add them to it with another function, and at the time if these child have child i add them to the previous items...
Now, the problem comes when i set the following properties as follow: IsOptionElementsEnabled = true, ItemsOptionListType = OptionListType.OptionList, SelectionMode = Telerik.Windows.Controls.SelectionMode.Single.
I would expect that only 1 RadTreeViewElement could be selected in the whole tree but that doesn't happen, in stead, the property SelectionMode = single only works for the child of each RadTreeViewItem, for example:
-Item1
-Item2
-Item4*
-Item5
-Item3
-Item6
-Item7*
here, only item4 or item5 can be selected at a time, but also item6 or item7, the asterics mean that they are selected I dont know if this is clear, i send a snipet of how i create the tree and the nodes
| public void createTree(RadTreeView rvTree, ObservableCollection<businessObject> obs) |
| { |
| try |
| { |
| rvTree.Items.Clear(); |
| rvTree.SelectionMode = Telerik.Windows.Controls.SelectionMode.Single; |
| rvTree.IsOptionElementsEnabled = true; |
| rvTree.ItemsOptionListType = OptionListType.OptionList; |
| foreach (var a in obs) |
| { |
| RadTreeViewItem tn = new RadTreeViewItem(); |
| tn.Header = a.Name; //A property of my business object |
| if (a.IsSelected == true) //Also a property of my business object |
| { |
| tn.CheckState = System.Windows.Automation.ToggleState.On; |
| tn.IsSelected = true; |
| } |
| tn.Tag = a; |
| if (a.Nodo_Padre == 0) //Proerty of my business object that indicates the key of the father item |
| { |
| rvTree.Items.Add(tn); |
| addNodes(tn, this.obsUnAuditable); |
| } |
| } |
| } |
| catch (Exception ex) |
| { |
| } |
| } |
| public void addNodes(RadTreeViewItem rvItem, ObservableCollection<businessObject> obs) |
| { |
| try |
| { |
| var x = (businesobject)rvItem.Tag; //I saved my Business object in the tag of the RadTreeViewItem |
| foreach (var y in obs) |
| { |
| if (y.Nodo_Padre == x.Clave)//Property that have the fathers key |
| { |
| RadTreeViewItem item = new RadTreeViewItem(); |
| item.Header = y.Nombre; //property of my businessobject |
| if (y.IsSelected == true) //Property of my business object |
| { |
| item.CheckState = System.Windows.Automation.ToggleState.On; |
| item.IsSelected = true; |
| item.Tag = y; |
| rvItem.Items.Add(item); |
| addNodes(item, this.obsUnAuditable); |
| } |
| else |
| { |
| item.Tag = y; |
| rvItem.Items.Add(item); |
| addNodes(item, this.obsUnAuditable); |
| } |
| } |
| } |
| } |
| catch (Exception ex) |
| { |
| } |
| } |
the tree that i give the function createTree as a parameter is created in the .xaml file.
Hope yo can help me with this, its a crucial need in the development.
Thank you!
