Making a radcontextmenu an application resource

5 posts, 0 answers
  1. Xaria D
    Xaria D avatar
    68 posts
    Member since:
    May 2010

    Posted 14 Jun 2010 Link to this post

    How to add the Rad ContextMenu to Application resource so that it can be used on other windows as well.
  2. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 14 Jun 2010 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Xaria D
    Xaria D avatar
    68 posts
    Member since:
    May 2010

    Posted 14 Jun 2010 Link to this post

    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.
  5. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 16 Jun 2010 Link to this post

    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.
  6. Xaria D
    Xaria D avatar
    68 posts
    Member since:
    May 2010

    Posted 05 Jul 2010 Link to this post


Back to Top
UI for WPF is Visual Studio 2017 Ready