getting Clicked Tree View Item

3 posts, 1 answers
  1. Alex
    Alex avatar
    36 posts
    Member since:
    Sep 2010

    Posted 11 Oct 2010 Link to this post

    Hi, I am having a problem getting clicked context menu item in TreeListView.
     
    I always get null when calling the following method:

    private RadTreeViewItem ClickedTreeViewItem
            {
                get
                {
                    return this.TreeContextMenu.GetClickedElement<RadTreeViewItem>();
                }
            }


    Please find xaml code below:

    <telerik:RadTreeListView BorderThickness="0"
                        x:Name="TreeListView" Background="White" 
                        ScrollViewer.HorizontalScrollBarVisibility="Auto"
                        ScrollViewer.VerticalScrollBarVisibility="Auto"
                        AutoGenerateColumns="false"
                        RowIsExpandedChanging="TreeListView_RowIsExpandedChanging"
                        RowIsExpandedChanged="TreeListView_RowIsExpandedChanged"
                        DataLoadMode="Synchronous"
                        SelectionChanged="TreeListView_SelectionChanged"
                        MouseRightButtonUp="TreeListView_MouseRightButtonUp"
        
                <telerik:RadContextMenu.ContextMenu
                    <telerik:RadContextMenu
                                x:Name="TreeContextMenu"
                                Opened="TreeContextMenu_Opened"
                                ItemClick="TreeContextMenu_ItemClick"
                        <telerik:RadContextMenu.Items
        
                        </telerik:RadContextMenu.Items
                    </telerik:RadContextMenu
                </telerik:RadContextMenu.ContextMenu
        
                <telerik:RadTreeListView.Columns
        
                     .... 
        
                </telerik:RadTreeListView.Columns
        
                <telerik:RadTreeListView.ChildTableDefinitions
                    <telerik:TreeListViewTableDefinition ItemsSource="{Binding Items}"/> 
                </telerik:RadTreeListView.ChildTableDefinitions
        
    </telerik:RadTreeListView>

  2. Answer
    Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 11 Oct 2010 Link to this post

    Hello Alex,

    If you are using the Q2 2010 version of RadControls or later you need to use the following code:

    private RadTreeViewItem ClickedTreeViewItem 
         get 
         
             return this.TreeContextMenu.GetClickedElement<TreeListViewRow>(); 
         
    }
    Hope this helps.

    All the best,
    Veselin Vasilev
    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
  3. DevCraft banner
  4. Alex
    Alex avatar
    36 posts
    Member since:
    Sep 2010

    Posted 11 Oct 2010 Link to this post

    Thank you
Back to Top