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

Making a radcontextmenu an application resource

4 Answers 153 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
Xaria D
Top achievements
Rank 1
Xaria D asked on 14 Jun 2010, 05:18 AM
How to add the Rad ContextMenu to Application resource so that it can be used on other windows as well.

4 Answers, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 14 Jun 2010, 11:43 AM
Hello Xaria D,

The only possible solution when sharing a visual element among multiple instance is to set x:Shared="false".
<Application x:Class="WpfApplication1.App"
        StartupUri="MainWindow.xaml">
    <Application.Resources>
  
        <telerik:RadContextMenu x:Key="contextMenu" x:Shared="false">
            <telerik:RadMenuItem Header="File" />
            <telerik:RadMenuItem Header="Open" />
            <telerik:RadMenuItem Header="Delete" />
        </telerik:RadContextMenu>
  
    </Application.Resources>
</Application>


Kind regards,
Kaloyan
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.
0
Xaria D
Top achievements
Rank 1
answered on 14 Jun 2010, 03:52 PM
But how can the main window display a  RadContextMenu?

<Window.ContextMenu>
<StaticResource ResourceKey="contextMenu"/>
</Window.ContextMenu>

accepts a ContextMenu, not RadContextMenu, and I cannot use RadWindow as MainWindow.
0
Kaloyan
Telerik team
answered on 16 Jun 2010, 11:08 AM
Hi Xaria D,

The RadContextMenu and the default WPF ContextMenu are two different controls. Check the code bellow that will help you refering the RadContextMenu as a resource:

<Window telerik:RadContextMenu.ContextMenu="{StaticResource contextMenu}" />

Best wishes,
Kaloyan
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.
0
Xaria D
Top achievements
Rank 1
answered on 06 Jul 2010, 04:30 AM

Tags
ContextMenu
Asked by
Xaria D
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Xaria D
Top achievements
Rank 1
Share this question
or