iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi
I have added a new UXMenuItem to the UXGridViewContextMenuStyle in blend (see DuplicateRowCommand).
<Style x:Key="UXGridViewContextMenuStyle" TargetType="Intersoft:UXGridViewContextMenu"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Intersoft:UXGridViewContextMenu"> <Grid x:Name="RootElement"> <Intersoft:UXContextMenu x:Name="ContextMenuElement" IsOpen="{TemplateBinding IsOpen}"> <Intersoft:UXMenuItem Command="local:UXGridViewContextMenuCommands.SortAscending" Header="{Binding ContextMenu_SortAscending, Source={StaticResource GridViewResource}}" Icon="/QMS;component/Assets/Images/16/sort_az_ascending2.png"/> <Intersoft:UXMenuItem Command="local:UXGridViewContextMenuCommands.SortDescending" Header="{Binding ContextMenu_SortDescending, Source={StaticResource GridViewResource}}" Icon="/QMS;component/Assets/Images/16/sort_az_descending.png"/> <Intersoft:UXSeparator x:Name="GroupSeparator"/> <Intersoft:UXMenuItem Command="local:UXGridViewContextMenuCommands.GroupByBox" Header="{Binding ContextMenu_GroupByBox, Source={StaticResource GridViewResource}}" IsCheckable="True"/> <Intersoft:UXMenuItem Command="local:UXGridViewContextMenuCommands.Group" Header="{Binding ContextMenu_Group, Source={StaticResource GridViewResource}}"/> <Intersoft:UXMenuItem Command="local:UXGridViewContextMenuCommands.Ungroup" Header="{Binding ContextMenu_Ungroup, Source={StaticResource GridViewResource}}"/> <Intersoft:UXSeparator x:Name="EditingSeparator"/> <Intersoft:UXMenuItem x:Name="CopyRowItem" Command="local:UXGridViewContextMenuCommands.CopyRow" Header="{Binding ContextMenu_CopyRow, Source={StaticResource GridViewResource}}" Icon="/QMS;component/Assets/Images/16/clipboard_add.png"/> <Intersoft:UXMenuItem Command="local:UXGridViewContextMenuCommands.Edit" Header="{Binding ContextMenu_Edit, Source={StaticResource GridViewResource}}" Icon="/QMS;component/Assets/Images/16/pencil.png"/> <Intersoft:UXMenuItem Command="local:UXGridViewContextMenuCommands.Delete" Header="{Binding ContextMenu_Delete, Source={StaticResource GridViewResource}}" Icon="/QMS;component/Assets/Images/16/delete.png"/> <Intersoft:UXMenuItem Command="local:UXGridViewContextMenuCommands.Update" Header="{Binding ContextMenu_Update, Source={StaticResource GridViewResource}}" Icon="/QMS;component/Assets/Images/16/check.png"/> <Intersoft:UXMenuItem Command="local:UXGridViewContextMenuCommands.Cancel" Header="{Binding ContextMenu_Cancel, Source={StaticResource GridViewResource}}" Icon="/QMS;component/Assets/Images/16/delete.png"/> <Intersoft:UXMenuItem Visibility="{Binding ElementName=CopyRowItem,Path=Visibility}" Command="{Binding DuplicateRowCommand}" CommandParameter="{Binding SelectedItem}" Header="Duplizieren" Icon="/QMS;component/Assets/Images/16/element_copy.png"/> <Intersoft:UXSeparator x:Name="BatchUpdateSeparator"/> <Intersoft:UXMenuItem Command="local:UXGridViewContextMenuCommands.SaveChanges" Header="{Binding ContextMenu_SaveChanges, Source={StaticResource GridViewResource}}" Icon="/Intersoft.Client.UI.Data;component/Resources/savechanges.png"/> <Intersoft:UXMenuItem Command="local:UXGridViewContextMenuCommands.RejectChanges" Header="{Binding ContextMenu_RejectChanges, Source={StaticResource GridViewResource}}" Icon="/Intersoft.Client.UI.Data;component/Resources/rejectchanges.png"/> </Intersoft:UXContextMenu> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
It works great. I have only the problem that the menu item is always visible (see attached picture).
A simple solution would be a visability-binding to CopyRow. But I am not so happy about this...
<Intersoft:UXMenuItem x:Name="CopyRowItem" Command="local:UXGridViewContextMenuCommands.CopyRow" Header="{Binding ContextMenu_CopyRow, Source={StaticResource GridViewResource}}" Icon="/QMS;component/Assets/Images/16/clipboard_add.png"/> <Intersoft:UXMenuItem Visibility="{Binding ElementName=CopyRowItem,Path=Visibility}" Command="{Binding DuplicateRowCommand}" CommandParameter="{Binding SelectedItem}" Header="Duplizieren" Icon="/QMS;component/Assets/Images/16/element_copy.png"/>
Can I find out which context menu (row or header) appears to control the visibility of items?
Thanks.
Regards
Michael
Hello Michael,
In order to achieve your scenario, it needs big efforts for it.First, you need to handle MouseDown event on UXGrid, then set validation if it is Row action or not to return the correct contextmenu by using execute command. To handle its visibility at first load, you also need to set CommandCannotExecute="Collapsed".I also attached how to use it. To run the sample simply use our MVVM Data Aplication (DevForce).
Regards,Handy
Hello,
Can I know how you apply the style in UXGridView? As far I know, UXGridView have not provided style for specific context menu. It can be done, but too much efforts. Our developer team would like to enhance this in the future. Regards,Handy
Hi Handy
As you've described in this thread. I've saved the style in UXGridViewStyle.xaml (see attached File).
In the UXGridViewStyle.xaml under UXGridViewStyle (line 999) you will find the following line of code:
<Intersoft:UXGridViewContextMenu x:Name="ContextMenu" Style="{StaticResource UXGridViewContextMenuStyle}"/>
In UXGridView I use:
Style="{StaticResource UXGridViewStyle}"
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname