This is a migrated thread and some comments may be shown as answers.

Focus at opening

2 Answers 13 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Bra
Top achievements
Rank 1
Veteran
Bra asked on 23 Sep 2020, 02:04 PM

Hi there, it's me again :)

 

Is it possible to focus an item of the tree ? I'm using the tree to select a value, that is saved. When I create the tree, I want to focus this value, previously defined. But I can't find any way to expand the tree to this item, and focus on it. I already have a customization to highlight this item, but it's not in the screen when the initialization is done, so I can't see that I already have a selected value (unless I scroll the whole tree to check it myself) :(

The ItemSource of the TreeView is a ObservableCollection<CustomObject> and I know exactly wich CustomObject I would like to focus.

Thank you :)

2 Answers, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 23 Sep 2020, 02:41 PM

Hi Bra,

The TreeView uses UI virtualization, meaning that it only renders the items it needs to that are visible to user on he screen. If the item is somewhere else in the tree, you need to programmatically expand that node and use the Programmatic Scrolling feature.

Those two articles will show you the code to use. What I'm not completely sure about is which order you need to take, so I recommend trying both ways: Expand first, then scroll.. or scroll first, then expand.

Let me know how it goes. If you have any trouble, please share the code you're using so we can attempt to replicate the issue.

Regards,
Lance | Manager Technical Support
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Bra
Top achievements
Rank 1
Veteran
answered on 28 Sep 2020, 01:17 PM
I'll try it, thank you :)
Tags
TreeView
Asked by
Bra
Top achievements
Rank 1
Veteran
Answers by
Lance | Manager Technical Support
Telerik team
Bra
Top achievements
Rank 1
Veteran
Share this question
or