contextmenu 相关问题

上下文菜单是图形用户界面中的菜单,其在用户交互时出现,例如鼠标右键单击或鼠标中键单击操作。

隐藏和取消隐藏上下文条菜单项c#

if(e.Button == MouseButtons.Right) { 字符串签名日期 = dataGridView3.CurrentRow.Cells[8].Value.ToString(); // MessageBox.Show(signatureDate); 如果(

回答 3 投票 0

如何在预览参数中实现带有自定义视图的上下文菜单,并可以在 SwiftUI 中进行交互?

我必须实现一个具有类似 iMessages 交互的聊天功能。我们决定使用 SwiftUI,因为它应该更快。但现在我在实现反应视图时陷入困境。

回答 1 投票 0

在Flutter中如何在选择特定文本时关闭SPdfViewer的上下文菜单?

在此处输入图像描述我想隐藏由“package:syncfusion_flutter_pdfviewer/pdfviewer.dart”提供的 SfPdfViewer 的默认上下文菜单,并且不想在

回答 1 投票 0

RelayCommand 未在 DataGridTextColumn WPF MVVM 内单击 MenuItem 时触发

我想在右键单击 EmpName 列上的“插入”菜单时添加新行,但它不会触发 InsertCommand。我在这里附上了 xaml 代码。请告诉我我在这里缺少什么。 我想在右键单击 EmpName 列上的“插入”菜单时添加新行,但它不会触发 InsertCommand。我在这里附上了 xaml 代码。请告诉我我在这里缺少什么。 <Window x:Class="DataGridRowsManagement.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:data="clr-namespace:DataGridRowsManagement" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800"> <Window.Resources> <data:ViewModel x:Key="EmpVM"></data:ViewModel> </Window.Resources> <Grid DataContext="{Binding Source={StaticResource EmpVM}}"> <DataGrid AutoGenerateColumns="False" Height="287" HorizontalAlignment="Left" Margin="23,12,0,0" Name="dgEmp" VerticalAlignment="Top" Width="657" ItemsSource="{Binding Path=Employees}" ColumnWidth="*" SelectedIndex="{Binding Path=RecordIndex,Mode=TwoWay}"> <DataGrid.Columns> <DataGridTextColumn Header="EmpNo" Binding="{Binding EmpNo}" /> <DataGridTemplateColumn Header="EmpName"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding EmpName}" HorizontalAlignment="Stretch"> <TextBlock.ContextMenu> <ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}"> <MenuItem Command="{Binding InsertCommand}" CommandParameter="{Binding RecordIndex}" Header="Insert"/> <MenuItem Command="{Binding DeleteCommand}" CommandParameter="{Binding RecordIndex}" Header="Delete"/> </ContextMenu> </TextBlock.ContextMenu> </TextBlock> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> <DataGridTextColumn Header="Salary" Binding="{Binding Salary}" /> <DataGridTextColumn Header="Designation" Binding="{Binding Designation}" /> </DataGrid.Columns> </DataGrid> </Grid> </Window> 这些绑定位于 DataTemplate 内,因此它们将尝试绑定到要模板化的项目。 尝试下一个: <Window ... x:Name="ThisWindow" <MenuItem Command="{Binding DataContext.InsertCommand, ElementName=ThisWindow}" />

回答 1 投票 0

Windows 11 - 如何修改 Windows 资源管理器上下文菜单中一组项目的标题?

在我的一个应用程序中,我在 Windows 11 的 Windows 资源管理器上下文菜单中添加了一个新项目。这效果很好,但现在我想添加一组项目。我可以通过更新

回答 1 投票 0

使用 ExtendedSubCommandsKey(和 python _winreg)的 Windows 级联上下文菜单

我试图使用“ExtendedSubCommandsKey”在 Windows 10 中创建级联上下文菜单。我尝试按照微软官方文档上的教程进行操作,但我无法让它工作。 结局...

回答 2 投票 0

如何在 iOS 中将此菜单添加到应用程序中?菜单类似于 iPhone 中的文本字段?

我想知道如何使用操作按钮(例如单击消息时出现在 Whatsapp 和其他应用程序上的操作按钮)来实现此“上下文菜单”。 非常感谢。

回答 1 投票 0

菜单项样式

我有一个包含以下项目的上下文菜单 我有一个包含以下项目的上下文菜单 <ContextMenu x:Name="NotificoContextMenu" x:Shared="false" x:Key="SysTrayMenu" x:FieldModifier="public" Loaded="NotificoContextMenu_Loaded" Style="{DynamicResource conte}"> <MenuItem Header="Connect" x:Name="ConnectMenuItem" x:FieldModifier="public" /> <MenuItem Header="Ping" Command="{Binding PingCommand}"/> <MenuItem Header="Show Window" Command="{Binding ShowWindowCommand}" /> <Separator /> <MenuItem Header="Exit" Command="{Binding ExitApplicationCommand}" /> </ContextMenu> 对于 ConnectMenuItem,我从代码中添加菜单项 我有一个上下文菜单样式,它适用于所有菜单项,除了我从代码中添加的菜单项,我应该做什么 这是我的上下文菜单的样式 <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Style TargetType="{x:Type ContextMenu}" x:Key="conte"> <Setter Property="Background" Value="{DynamicResource PrimaryDark}" /> <Setter Property="Foreground" Value="{DynamicResource Secendery}" /> <Setter Property="SnapsToDevicePixels" Value="True" /> <Setter Property="OverridesDefaultStyle" Value="True" /> <Setter Property="HasDropShadow" Value="True" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ContextMenu}"> <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding Foreground}" BorderThickness="0.5" CornerRadius="5"> <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" /> </Border> <ControlTemplate.Triggers> <Trigger Property="HasDropShadow" Value="true"> <Setter TargetName="Border" Property="Padding" Value="0,3,0,3" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary> 日夜寻找时发现了一些灵魂出处 这是完整的 Windows 资源文件: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Style TargetType="{x:Type ContextMenu}" x:Key="conte"> <Setter Property="Background" Value="{DynamicResource PrimaryDark}" /> <Setter Property="Foreground" Value="{DynamicResource Secendery}" /> <Setter Property="SnapsToDevicePixels" Value="True" /> <Setter Property="OverridesDefaultStyle" Value="True" /> <Setter Property="HasDropShadow" Value="True" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ContextMenu}"> <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding Foreground}" BorderThickness="0.85" CornerRadius="5"> <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle"> </StackPanel> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="{x:Type MenuItem}" > <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type MenuItem}"> <Grid SnapsToDevicePixels="true"> <DockPanel> <ContentPresenter x:Name="Icon" ContentSource="Icon" Margin="4,0,6,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/> <Path x:Name="GlyphPanel" Fill="{TemplateBinding Foreground}" FlowDirection="LeftToRight" Margin="10,0,0,0" Visibility="Collapsed" VerticalAlignment="Center"/> <ContentPresenter x:Name="content" ContentSource="Header" Margin="10,3" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> </DockPanel> <Popup x:Name="PART_Popup" AllowsTransparency="True" Focusable="false" HorizontalOffset="0" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" Placement="Left" VerticalOffset="0"> <Border BorderThickness="0.85" CornerRadius="2" BorderBrush="{DynamicResource Secendery}" Background="{TemplateBinding Background}"> <ScrollViewer x:Name="SubMenuScrollViewer" CanContentScroll="true" Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}"> <Grid RenderOptions.ClearTypeHint="Enabled"> <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Cycle" Grid.IsSharedSizeScope="true" Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle"/> </Grid> </ScrollViewer> </Border> </Popup> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="TextBlock.Foreground" Value="White" TargetName="content"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary>

回答 1 投票 0

默认上下文菜单仅更改颜色

我有这个问题,我为我的wpf窗口设置了样式,其中一部分用于默认ContextMenu,但仍然有部分默认样式。 我尝试为每种类型的控件设置背景...

回答 1 投票 0

添加嵌套菜单项时出现问题 - 嵌套项目未显示

我正在尝试添加嵌套(子)菜单项。显示主菜单项,但不显示子菜单项。显然我缺少一个属性,但无法弄清楚。任何指示将不胜感激......

回答 1 投票 0

MenuItem SubMenu 出现在 ContextMenu 的左侧而不是默认的

这个问题与这里的帖子相关 - 原来的问题已经解决,但随后又出现了另一个问题。 正如您所看到的,MenuItem 出现在错误的一侧 由于上一问题与

回答 1 投票 0

自定义上下文菜单在移动设备上不起作用

我有一个使用 NextJS 构建的聊天应用程序,我正在尝试添加自定义上下文菜单来固定、收藏或删除消息。到目前为止,这是我的代码: const [isContextClicked, setIsContextClicked] = useStat...

回答 1 投票 0

添加 shell 上下文菜单项,以便我可以通过右键单击将文件夹添加到路径

在工作中,我经常必须安装新的框架等,这些框架不会将自己添加到路径中,并且我必须经历将可执行文件添加到路径中的繁琐过程。因此我决定添加一个...

回答 2 投票 0

XAML 中的 WPF 合并上下文菜单

是否可以在XAML中合并两个ContextMenu? 我创建了两个 ContextMenues 作为资源。我在几个数据模板中使用它们并且工作正常。但是,对于某些数据模板,我希望...

回答 1 投票 0

将自定义宏添加到 Outlook 中的右键单击上下文菜单

我正在尝试添加一个自定义按钮,在右键单击电子邮件时将我的宏启动到上下文菜单。我在工作环境中执行此操作,并且无法访问除

回答 1 投票 0

Qt 中连接的自定义上下文菜单

我在 QListWidget 中连接自定义菜单时遇到问题,connect 函数返回 false。这是代码: 我有一些名为 MainWindow 的主窗口类。在它的构造函数中我有这个...

回答 1 投票 0

如何修复 VS 2022 中解决方案资源管理器中的上下文菜单

安装 SSIS 和 SSRS 的一些扩展后,刷新选项在上下文菜单中显示 4 次。我该如何删除它们?仅当右键单击文件时才会显示。 寻找

回答 2 投票 0

在自定义上下文菜单中获取 Matlab 数据提示值

在 Matlab 中,我希望在右键单击图中的数据点时打开上下文菜单。所选操作应该调用一个函数,我想在其中访问数据点的坐标...

回答 1 投票 0

通过上下文菜单 SwiftUI“弹出”时展开图像

我正在尝试实现按住图像时在“照片”应用程序中获得的功能。出现一个上下文菜单,其中包含各种选项(复制、共享、收藏夹等..),但主要...

回答 1 投票 0

右键单击 QTableWidget 获取标题列

我有一个 QTableWidget,其中有许多列只是复选框(有些不是)。我正在尝试实现一项功能,以便当用户右键单击与“

回答 2 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.