Available for: Windows 8.1

Use One RadRadialMenu for Many Target Elements

This example demonstrates how to define a single instance of RadRadialMenu and use it as a context menu for multiple targets.

First you should read the Define RadRadialMenu as a Static Resource article to see how to define a RadRadialMenu as a static resource.

After that you can bind the RadRadialContextMenu.Menu attached property of the target elements to the Menu property of the RadialMenuProvider instance defined in the Resources of the Page.

<StackPanel Background="{StaticResource ApplicationPageBackgroundThemeBrush}" >
    <TextBlock Text="Hover me!" FontSize="20"
               Margin="10" Width="150" TextAlignment="Center"
               telerikPrimitives:RadRadialContextMenu.Menu="{Binding Menu, Source={StaticResource menuProvider}}">
        <telerikPrimitives:RadRadialContextMenu.Behavior>
            <telerikPrimitives:RadialMenuTriggerBehavior AttachTriggers="PointerOver"/>
        </telerikPrimitives:RadRadialContextMenu.Behavior>
    </TextBlock>

    <Grid>
        <Rectangle Margin="10" Width="150" Height="50" Fill="DodgerBlue"
                   telerikPrimitives:RadRadialContextMenu.Menu="{Binding Menu, Source={StaticResource menuProvider}}">
            <telerikPrimitives:RadRadialContextMenu.Behavior>
                <telerikPrimitives:RadialMenuTriggerBehavior AttachTriggers="PointerPressed"/>
            </telerikPrimitives:RadRadialContextMenu.Behavior>
        </Rectangle>
        <TextBlock Text="Press me!" HorizontalAlignment="Center" VerticalAlignment="Center"
                   IsHitTestVisible="False" FontSize="20" Foreground="White"/>
    </Grid>

    <TextBox Text="TextBox" Margin="10" Width="150" TextAlignment="Center"
             telerikPrimitives:RadRadialContextMenu.Menu="{Binding Menu, Source={StaticResource menuProvider}}">
        <telerikPrimitives:RadRadialContextMenu.Behavior>
            <telerikPrimitives:RadialMenuTriggerBehavior AttachTriggers="Focused"/>
        </telerikPrimitives:RadRadialContextMenu.Behavior>
    </TextBox>
</StackPanel>

This is the result:

Radial Menu-How To-Reusing

See Also