New to Telerik UI for WinUI? Download free 30-day trial

Define RadRadialMenu as a Static Resource

If you wish to reuse the same RadRadialMenu for different targets, then you could define it as a static resource. The RadRadialMenu is a FrameworkElement and if you define it directly in the Resources of the Page, it will be attached to the visual tree as a child of the Page. This leads to the following behavior - when the menu is used as a contex menu, it is visualized in a popup; if the menu is already in the children collection of the page, it can not be added as a child of the popup.

As a workaround you can create a class that has a RadRadialMenu property that will hold the instance of the radial menu we will reuse. This class is not a FrameworkElement, hence it will not be added to the visual tree and we will avoid the problem.

Example 1: Custom Class

public class RadialMenuProvider 
{ 
    public RadRadialMenu Menu { get; set; } 
} 
Now we can define an instance of this class in the Resources of the Page.

Example 2: Set RadialMenuProvider as a Static Resource

<Page.Resources> 
    <local:RadialMenuProvider x:Key="menuProvider"> 
        <local:RadialMenuProvider.Menu> 
            <navigation:RadRadialMenu> 
                <navigation:RadialMenuItem Header="Item 1"/> 
                <navigation:RadialMenuItem Header="Item 2"/> 
                <navigation:RadialMenuItem Header="Item 3"/> 
            </navigation:RadRadialMenu> 
        </local:RadialMenuProvider.Menu> 
    </local:RadialMenuProvider> 
</Page.Resources> 

See Also

In this article
Not finding the help you need?