Selected container problem

2 posts, 0 answers
  1. Hrishikesh Mehta
    Hrishikesh Mehta avatar
    3 posts
    Member since:
    Feb 2010

    Posted 30 Mar 2010 Link to this post

    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 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...

  2. Miroslav
    Miroslav avatar
    922 posts

    Posted 06 Apr 2010 Link to this post

    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,
    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.
Back to Top