Ryan Black
Top achievements
Rank 1
Ryan Black
asked on 18 Nov 2010, 04:27 PM
I have been having trouble selecting a treeview item that is located a few nodes deep.
You can see my example here: File Expand and Select
To get the example working, please copy the foo folder to c:\foo.
Thanks for all your help
Ryan
You can see my example here: File Expand and Select
To get the example working, please copy the foo folder to c:\foo.
Thanks for all your help
Ryan
8 Answers, 1 is accepted
0
Hello Ryan Black,
I examined your project and did not manage to understand your issue. Pressing the button adds a new file in the second tree level (level with root "GG") and selects it. On the other hand, selecting a node that is located several levels deep works just fine. Could please elaborate more on the scenario that shows the problem best ? If you can please list the steps to reproduce the issue and/or send us a video illustrating the behavior on your side, that will also help us further investigate the issue.
Thank you for the cooperation in advance.
Best wishes,
Petar Mladenov
the Telerik team
I examined your project and did not manage to understand your issue. Pressing the button adds a new file in the second tree level (level with root "GG") and selects it. On the other hand, selecting a node that is located several levels deep works just fine. Could please elaborate more on the scenario that shows the problem best ? If you can please list the steps to reproduce the issue and/or send us a video illustrating the behavior on your side, that will also help us further investigate the issue.
Thank you for the cooperation in advance.
Best wishes,
Petar Mladenov
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Ryan Black
Top achievements
Rank 1
answered on 23 Nov 2010, 08:08 PM
Heres the problem.
If you click Add text file, and you have nothing expanded, the folders needs to expand and show the item selected. The bug is that currently the folders are not expanding all the way down to the treeview item that I want selected.
Hope this is a little more clear.
Ryan
If you click Add text file, and you have nothing expanded, the folders needs to expand and show the item selected. The bug is that currently the folders are not expanding all the way down to the treeview item that I want selected.
Hope this is a little more clear.
Ryan
0
Hi Ryan Black,
We modified the solution in order to work for you. Basically, in the second method ExpandAndSelectItem(ItemsControl itemsControl, object itemToSelect) you are trying to use RadTreeViewItem that is not generated. You can generate it by expanding his father in ExpandAndSelectItem(object itemToSelect) .
However, I highly recommend you to use ExpandItemByPath and GetItemByPath methods in order to achieve the desired effect.
Hope this has helped you and you`ll feel free to ask if you need further assistance.
Greetings,
Petar Mladenov
the Telerik team
We modified the solution in order to work for you. Basically, in the second method ExpandAndSelectItem(ItemsControl itemsControl, object itemToSelect) you are trying to use RadTreeViewItem that is not generated. You can generate it by expanding his father in ExpandAndSelectItem(object itemToSelect) .
However, I highly recommend you to use ExpandItemByPath and GetItemByPath methods in order to achieve the desired effect.
Hope this has helped you and you`ll feel free to ask if you need further assistance.
Greetings,
Petar Mladenov
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Ryan Black
Top achievements
Rank 1
answered on 30 Nov 2010, 06:06 PM
Petar,
Thanks for all your help. I want to always use best practices with these controls and have tried to implement ExpandItemByPath and GetItemByPath . I followed some examples and seem to be missing something.
Could you please look at my modified FileExplorerExample and see what I have missed.
Thanks
Ryan
File Explorer Example
Thanks for all your help. I want to always use best practices with these controls and have tried to implement ExpandItemByPath and GetItemByPath . I followed some examples and seem to be missing something.
Could you please look at my modified FileExplorerExample and see what I have missed.
Thanks
Ryan
File Explorer Example
0
Hello Ryan Black,
It seems that you are trying to expand an item in your outer tree( "fileExplorer" ) instead of your inner tree ("foldertree"). On the other hand, you must specify the property of your business object that GetItemByPath and ExpandItemByPath methods use in their search algorithms:
I modified your solution accordingly. Please examine it and let me know if it works for you. Also, please keep in mind that since you have nested RadTreeViews, you should be careful which RadTreeView's features you need to use at a certain point. Also, I am not sure why your scenario requires using nested RadTreeViews, but if your logic can be implemented with just one RadTreeView, it would simplify your code.
Regards,
Petar Mladenov
the Telerik team
It seems that you are trying to expand an item in your outer tree( "fileExplorer" ) instead of your inner tree ("foldertree"). On the other hand, you must specify the property of your business object that GetItemByPath and ExpandItemByPath methods use in their search algorithms:
<
telerik:RadTreeView
IsExpandOnSingleClickEnabled
=
"True"
telerik:TextSearch.TextPath
=
"Name"
/>
Regards,
Petar Mladenov
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Ryan Black
Top achievements
Rank 1
answered on 03 Dec 2010, 05:51 PM
Petar,
That works perfectly and the double RadTreeView was done by accident. However, I believe there is one fundamental thing I am not understanding correctly between Telerik controls and WPF.
I modified the example to open another window that should auto expand and select the item in the list. I thought the problem was with the ItemContainerGenerator.Status, but it seems that is only part of the issue.
In our real application this type of scenario is very common, and I think this final example will solve a lot of our future potential issues.
Thanks for all your continued help!
Ryan
File Explorer Example
That works perfectly and the double RadTreeView was done by accident. However, I believe there is one fundamental thing I am not understanding correctly between Telerik controls and WPF.
I modified the example to open another window that should auto expand and select the item in the list. I thought the problem was with the ItemContainerGenerator.Status, but it seems that is only part of the issue.
In our real application this type of scenario is very common, and I think this final example will solve a lot of our future potential issues.
Thanks for all your continued help!
Ryan
File Explorer Example
0
Accepted
Hi Ryan Black,
You can use the Loaded event of the Window that shows when you click the button instead of the ItemContainerGenerator.StatusChanged. Also, you need to use the RadTreeView that is inside the "fileExplorer" again ( you can access it via the RadTreeView.ChildrenOfType<RadTreeView>() method ). Please notice that the containers are generated only when they are needed ( in your case when you expand an item that contains child RadTreeVieItems) so StatusChanged doesn`t help you. Please inspect the attached solution and let us know if it satisfies you or not.
Greetings,
Petar Mladenov
the Telerik team
You can use the Loaded event of the Window that shows when you click the button instead of the ItemContainerGenerator.StatusChanged. Also, you need to use the RadTreeView that is inside the "fileExplorer" again ( you can access it via the RadTreeView.ChildrenOfType<RadTreeView>() method ). Please notice that the containers are generated only when they are needed ( in your case when you expand an item that contains child RadTreeVieItems) so StatusChanged doesn`t help you. Please inspect the attached solution and let us know if it satisfies you or not.
Greetings,
Petar Mladenov
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Ryan Black
Top achievements
Rank 1
answered on 08 Dec 2010, 04:52 PM
Thats exactly what I was looking for. These examples have greatly allowed us to resolve many issues.
Thank you so much for all of you support.
Ryan
Thank you so much for all of you support.
Ryan