change RadPane default ContextAMenu

1 Answer 21 Views
Docking
Hen
Top achievements
Rank 1
Veteran
Hen asked on 30 Aug 2021, 11:18 AM

Dear sir,

RadPane gives as a default ContextMenu while pressing on the header .

 The Context menu contains the option of Hide.

Our customers can't make this RasPane visibly again, therefore for them it's act like  delete.

how can we change the Text inside this default  ContextMenu from Hide to Delete?

thank you

yafit

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 01 Sep 2021, 02:47 PM

Hello Yafit,

To change the default ContextMenu, you can create a DataTemplate and then set it to the ContextMenuTemplate property of the RadPane element. The following snippet shows how to set the mentioned property:

<telerik:RadPane x:Name="radPane" 
             Header="Pane 1"> 
    <telerik:RadPane.ContextMenuTemplate> 
        <DataTemplate> 
            <telerik:RadContextMenu> 
                <telerik:RadMenuItem Header="Delete" /> 
            </telerik:RadContextMenu> 
        </DataTemplate> 
    </telerik:RadPane.ContextMenuTemplate> 
</telerik:RadPane> 

And to make the menu item functional, you can use the ClosePane command which comes from the predefined RadDocking commands. They can be found in the RadDockingCommands class. That said, the result should look as follows:

<telerik:RadPane x:Name="radPane" 
             Header="Pane 1"> 
    <telerik:RadPane.ContextMenuTemplate> 
        <DataTemplate> 
            <telerik:RadContextMenu> 
                <telerik:RadMenuItem Header="Delete" Command="telerik:RadDockingCommands.ClosePane"/> 
            </telerik:RadContextMenu> 
        </DataTemplate> 
    </telerik:RadPane.ContextMenuTemplate> 
</telerik:RadPane> 

In conclusion, I have prepared a sample project, in which a custom DataTemplate is set for each of the ContextMenuTemplate properties of the pane elements. Please have a look and let me know if this provides the desired result.

Regards,
Stenly
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Docking
Asked by
Hen
Top achievements
Rank 1
Veteran
Answers by
Stenly
Telerik team
Share this question
or