lonely红茶 发表于 2015-5-4 09:35:00

请问在行列标题上右键时如何出现菜单

rt

iceman 发表于 2015-5-4 13:33:00

回复 1楼lonely红茶的帖子

翻阅了下您的历史记录,可能是需要自定义Spread设计器,我们提供了 Spread 设计器源码,其中所有功能都是通过调用 Spread XAML 平台接口实现。包括表头右键菜单:
http://www.gcpowertools.com.cn/downloads/demo/SpreadDesignerforWPF-Silverlight.zip

lonely红茶 发表于 2015-5-4 14:28:00

回复 2楼iceman的帖子

源码中哪部分是设置这个的 看了一遍源码没有找到

iceman 发表于 2015-5-4 14:59:00

回复 3楼lonely红茶的帖子

相关代码如下:

            menuItem = new MenuItem();
            menuItem.Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_Headers;
            menuItem.Click += new RoutedEventHandler(HeadersmenuItem_Click);
            contextMenu.Items.Add(menuItem);



private ContextMenu GetColumnHeaderContextMenu()
      {
            ContextMenu contextMenu = new System.Windows.Controls.ContextMenu();

            Image icon = new Image() { Source = new BitmapImage(new Uri(@"pack://application:,,,/SpreadSheetDesigner;component/Images/Cut.png")) };
            MenuItem menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_Cut, Command = DesignerCommands.Cut, Icon = icon };
            contextMenu.Items.Add(menuItem);
            icon = new Image() { Source = new BitmapImage(new Uri(@"pack://application:,,,/SpreadSheetDesigner;component/Images/Copy.png")) };
            menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_Copy, Command = DesignerCommands.Copy, Icon = icon };
            contextMenu.Items.Add(menuItem);
            icon = new Image() { Source = new BitmapImage(new Uri(@"pack://application:,,,/SpreadSheetDesigner;component/Images/Paste16.png")) };
            menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_Paste, Command = DesignerCommands.Paste, CommandParameter = "All", Icon = icon };
            contextMenu.Items.Add(menuItem);
            contextMenu.Items.Add(new Separator());

            menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.InsertDialog_Title, Command = DesignerCommands.InsertEntireColumn };
            contextMenu.Items.Add(menuItem);
            menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.DeleteDialog_Delete, Command = DesignerCommands.DeleteEntireColumn };
            contextMenu.Items.Add(menuItem);
            menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_ClearContents, Command = DesignerCommands.ClearContents };
            contextMenu.Items.Add(menuItem);
            contextMenu.Items.Add(new Separator());

            icon = new Image() { Source = new BitmapImage(new Uri(@"pack://application:,,,/SpreadSheetDesigner;component/Images/FormatCells.png")) };
            menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_FormatCells, Command = DesignerCommands.ShowFormatCellsDialog, CommandParameter = "Number", Icon = icon };
            contextMenu.Items.Add(menuItem);
            menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_ColumnWidth };
            menuItem.Click += new RoutedEventHandler(ColumnWidthMenuItem_Click);
            contextMenu.Items.Add(menuItem);
            menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_Hide, Command = DesignerCommands.HideColumns };
            contextMenu.Items.Add(menuItem);
            menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_Unhide, Command = DesignerCommands.UnhideColumns };
            contextMenu.Items.Add(menuItem);

            menuItem = new MenuItem();
            menuItem.Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_Headers;
            menuItem.Click += new RoutedEventHandler(HeadersmenuItem_Click);
            contextMenu.Items.Add(menuItem);

            return contextMenu;
      }

iceman 发表于 2015-5-12 09:41:00

回复 3楼lonely红茶的帖子

请问当前问题是否解决?如果没有请继续跟帖。
为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢   
http://gcdn.gcpowertools.com.cn/attachment.aspx?attachmentid=10062
页: [1]
查看完整版本: 请问在行列标题上右键时如何出现菜单