GetClickedElement is null in unpinned RadPane

2 posts, 0 answers
  1. Rick Glos
    Rick Glos avatar
    70 posts
    Member since:
    Mar 2009

    Posted 16 May 2011 Link to this post

    According to the documentation here, to get the RadTreeViewItem so that you can dynamically set the context menu, you need to add a handler for the Opened event and retrieve it like so:

    RadTreeViewItem item = ((RadContextMenu)sender).GetClickedElement<RadTreeViewItem>();

    We have an application using RadDocking with the RadTreeView in a RadPane.  It works with the pane pinned but if I unpin the pane and right click, GetClickedElement returns null.  Here's some simple XAML to recreate it:

    <Window x:Class="DockingTreeViewContextMenu.MainWindow"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <telerik:RadDocking>
                <telerik:RadDocking.DocumentHost>
                    <telerik:RadSplitContainer>
                        <telerik:RadPaneGroup>
                            <telerik:RadDocumentPane Header="Content"></telerik:RadDocumentPane>
                        </telerik:RadPaneGroup>
                    </telerik:RadSplitContainer>
                </telerik:RadDocking.DocumentHost>
                <telerik:RadSplitContainer>
                    <telerik:RadPaneGroup>
                        <telerik:RadPane Header="Pane 1">
                            <telerik:RadTreeView>
                                <telerik:RadContextMenu.ContextMenu>
                                    <telerik:RadContextMenu Opened="RadContextMenu_Opened">
                                    </telerik:RadContextMenu>
                                </telerik:RadContextMenu.ContextMenu>
                                <telerik:RadTreeViewItem Header="Item #1">
                                    <telerik:RadTreeViewItem Header="Item #1.1"></telerik:RadTreeViewItem>
                                    <telerik:RadTreeViewItem Header="Item #1.1"></telerik:RadTreeViewItem>
                                    <telerik:RadTreeViewItem Header="Item #1.1"></telerik:RadTreeViewItem>
                                </telerik:RadTreeViewItem>
                                <telerik:RadTreeViewItem Header="Item #2" />
                                <telerik:RadTreeViewItem Header="Item #3" />
                            </telerik:RadTreeView>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
            </telerik:RadDocking>
        </Grid>
    </Window>


    So if I slide out the pane and right click the tree node, I get a null result whereas I get the RadTreeViewItem when the pane is pinned.  I'm I using the control incorrectly?
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 20 May 2011 Link to this post

    Hello Rick Glos,

    Please excuse us for the delayed response and for any inconvenience caused. This appears to be a bug in our controls suite. We logged it in our PITS where you will be able to track its status. We'll work on it after the official Q2 2011 release scheduled for the middle of July. We also updated your telerik account points. Let us know if you need more info.

    Kind regards,
    Petar Mladenov
    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. UI for WPF is Visual Studio 2017 Ready
Back to Top