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

Selected container problem

1 Answer 79 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Hrishikesh Mehta
Top achievements
Rank 1
Hrishikesh Mehta asked on 30 Mar 2010, 01:03 PM
I am using the treelistview in sl4...i need to implement right click context menu...i created an rightclick event handler and in that i m setting the current selected item...
ex treelist.selecteditem=(e.originalsource as RadTreeListViewItem)

this calls the selection change event...in this event i get the currently selected item...but the selectedcontainer is null....

now when i right click on some other node and debug my code...the selected item gets changed accordingly but now the selected container is set to the container of the previously selected item!!!!! selected container does not get changed when the selecteditem changes...

Plz help...i m stuck pretty bad...


1 Answer, 1 is accepted

Sort by
0
Miroslav
Telerik team
answered on 06 Apr 2010, 10:47 AM
Hi Hrishikesh Mehta,

I am sorry for the delayed reply.

Indeed the selected container may not always be available when the selection is changed. Sometimes it may not be available at all if it has not been generated yet.

Normally if it is available, it will be found. You access in a dispatcher like so:

void treeList_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
{
    Dispatcher.BeginInvoke(() =>
        {
            var container = treeList.SelectedContainer;
        });
}

This means that the code in the dispatcher will eb executed a little bit later when the container will be available.

Please note that the TreeListView is a CTP and major changes are expected in the next version when we will base the control on the GridView rather than the TreeView. It is best not to base any production code on it yet.

Kind regards,
Miroslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
TreeListView
Asked by
Hrishikesh Mehta
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
Share this question
or