13 Answers, 1 is accepted


Let me provide you with exact steps that I'm trying to perform:
1. Select any item in the RadTreeListView hierarchy.
2. Store selection item (we have to know which item has been selected)
3. Perform changes on related data of selected item of the RadTreeListView (From one side of UI we have RadTreeListView and from other one related control with some info of selected item).
4. When changes has been performed - reload the data in RadTreeListView and select the item that was previously edited.
How to solve it ?
Julian.

regards,
Julian
Generally radTreeListView.ScrollIntoViewAsync(item) should do the job.
If this doesn't help, please send me a small sample project which I can debug on my side in order to see what is going on?
Thank you in advance.
Nedyalko Nikolov
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Well, let me shine a little bit more light on my problem.
Assume that I have the following code:
this.radTreeListView.SelectionChanged += (s, e) =>
{
if (this.radTreeListView.SelectedItem != null)
{
var yamlItem = this.radTreeListView.SelectedItem as YamlItem;
if (yamlItem != null && yamlItem.Type != SignalType.Subsystem)
{
// store selected item into variable
this.storedSelectedItem = this.radTreeListView.SelectedItem;
}
}
};
Let's also assume that when collection of RadTreeListView is going to be changed we have to re-select the last selected item that we stored in local variable this.storedSelectedItem.
this.radTreeListView.Items.CollectionChanged += (s, e) =>
{
this.radTreeListView.ScrollIntoViewAsync(this.storedSelectedItem, null);
};
Of course It doesn't works, becouse the old collection was replaced by the new collection, and this.storedSelectedItem has another HashCode, that's why this.radTreeListView.ScrollIntoViewAsync(this.storedSelectedItem, null); can't find such item in its collection.
Well, to solve this issue I would like to foreach throw the all existed items in the this.radTreeListView.Items, and when I find the item that is equals to my stored item this.storedSelectedItem.SomeTextValue (I will compare these items by string value that has each item) and afterwords I call this method this.radTreeListView.ScrollIntoViewAsync(this.storedSelectedItem, null);.
That was my idea how to solve it, but I need your support how to foreach throw the hierarchical data structure of this.radTreeListView.Items.
Maybe you have another solution how to solve it ?
Please need your advice ASAP !
Kind regards,
Julian
The best approach should be if you can use one and the same HashCode for a single item. However iterating through RadTreeListView.Items collection should be easy, just keep in mind that different objects could be returned due to hierarchical nature of the data source. For example:
Parent1
Child1
Child2
Parent2
Child3
Items will have 5 items ordered (Parent1, Child1, Child2, Parent2, Child3).
Let me know if this doesn't help.
Nedyalko Nikolov
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Please provide me with simple example.
Regards,
Julian

Would you be so kind to provide us with working example as soon as possible or/and any status of current issue.
Thank you in advance,
Julian
I am sending you a sample project illustrating a possible approach for iterating through the Items collection.
Let me know whether it corresponds to your requirements.
Maya
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Thank you for solution.
The last question how to Expand concrete group where selected item is located ?
Thank you in advance.
Generally, if you want to get the parent item, you can do it only at data level, i.e. you need to have a property for example connecting the parent and child elements. However, depending on your specific settings and requirements, the child items may not be available unless being expanded.
Kind regards,Maya
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

I have a property "Parent" in my data model that represent the Parent (Group) of items that are located under the Parent node. The question is how to use ExpandGroup (IGroup group). How to get IGroup according to my SelectedItem that is of type MyCustomDataCollection ?
I would appritiate if you could help me with that too :)
Thanks,
Julian
Please excuse me if I am missing something, but as you are referring to expanding groups, I got a bit confused. Are you referring to a RadGridView or RadTreeListView control ? Generally, there are no groups in RadTreeListView.
Maya
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!