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
290
GalleryItem Context Menu
posted

Hi,

 

Is there any way how to display context menu for the GalleryItem?

I have tried to use the following XAML but it does not work,

 

 <ig:GalleryTool Caption="Views Gallery">

                                <ig:GalleryItem Text="Yesterday" Image="/Test.Dashboard.Infrastructure;component/Images/22/view_left_right.png">

                                    <ig:ContextMenuService.Manager>

                                    <ig:ContextMenuManager>

                                        <ig:ContextMenuManager.ContextMenu>

                                            <ig:XamContextMenu>

                                                <ig:XamMenuItem Header="Rename" />

                                                <ig:XamMenuItem Header="Delete"/>                                                                                                 

                                            </ig:XamContextMenu>

                                        </ig:ContextMenuManager.ContextMenu>

                                    </ig:ContextMenuManager>

                            </ig:ContextMenuService.Manager>

                                </ig:GalleryItem>                                                           

                            </ig:GalleryTool>

 

 

Thanks,

Alex

  • 6475
    Verified Answer
    posted

    Hi,

    One way to achieve this is by using a Style:

    <ig:GalleryTool>
        <ig:GalleryTool.Settings>
            <ig:GalleryItemSettings>
                <ig:GalleryItemSettings.GalleryItemStyle>
                    <Style TargetType="ig:GalleryItemControl">
                        <Setter Property="ig:ContextMenuService.Manager">
                            <Setter.Value>
                                <ig:ContextMenuManager OpenMode="RightClick">
                                    <ig:ContextMenuManager.ContextMenu>
                                        <ig:XamContextMenu>
                                            <ig:XamMenuItem Header="Rename" />
                                            <ig:XamMenuItem Header="Delete" />
                                        </ig:XamContextMenu>
                                    </ig:ContextMenuManager.ContextMenu>
                                </ig:ContextMenuManager>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ig:GalleryItemSettings.GalleryItemStyle>
            </ig:GalleryItemSettings>
        </ig:GalleryTool.Settings>
                                    
        <ig:GalleryItem Text="Item 1" />                                                                   
        <ig:GalleryItem Text="Item 2" />
        <ig:GalleryItem Text="Item 3"/>
    </ig:GalleryTool>

     

    Hope this helps,