Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
35
Can Xam Diagram and Xam Radial Menu be integrated on the same view
posted

I have used XamDiagram to define certain images in my view, which are bound to certain objects. Now, Is it possible to integrate a Radial Menu to these images?.

Can I make the Image pop a Radial Menu when it is clicked?.




<Grid Margin="0" Height="Auto" >
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Image Source="{Binding ImagePath}" Height="65" Width="65" Stretch="Uniform" />
<TextBlock Text="{Binding Mode=OneWay, Path=Name}" Grid.Row="1" TextWrapping="Wrap" Margin="1" TextAlignment="Center" />
</Grid>



<ig:XamDiagram x:Name="mydiagram" Grid.RowSpan="2"
------
------
<ig:XamDiagram.ContextMenu>
<ContextMenu >
<MenuItem Header="{Binding OptionMenuText}" Visibility="{Binding IsOptionMenuVisible, Converter={StaticResource BoolToVis}}" Click="MenuItem_Click"/>
</ContextMenu>
</ig:XamDiagram.ContextMenu>

<ig:XamDiagram.NodeDefinitions>
<ig:NodeDefinition TargetType="-----"
--------
--------
</ig:NodeDefinition>
</ig:XamDiagram.NodeDefinitions>
<ig:XamDiagram.ConnectionDefinitions>
---------
--------
</ig:XamDiagram.ConnectionDefinitions>
<ig:XamDiagram.Layout>
<layout:CustomLayout />
</ig:XamDiagram.Layout>
</ig:XamDiagram>

  • 20
    Offline posted

    I think you can just add the xamRadialMenu to a custom context menu on any control. Then you can use the ContextMenu's Opened and Closed events to make the radial menu open and close in sync. Also, to make the central button of the xamRadialMenu appear beneath the cursor use the ContextMenu's HorizontalOffset and VerticalOffset properties.

    <Grid>
    
        <Grid.ContextMenu>
        
            <ContextMenu>
            
                <ControlTemplate>
                
                    <Grid>
                    
                        <ig:XamRadialMenu/>
                    
                    </Grid>
                
                </ControlTemplate>
            
            </ContextMenu>
    
        </Grid.ContextMenu>
    
    </Grid>

  • 17475
    Offline posted

    Hello Jonathan and thank you for posting!

    I have gone through your requirements and made further investigation on the matter. As the XamRadialMenu is a visual element that needs to be added to the visual tree in order to be displayed.  You may add it to the visual tree in a collapsed state. Then, when a user clicks on the image, the Visibility could change to visible to display the menu and to allow the user interact with it.