WPF 绑定 DataGrid 里面 Button点击事件 TextBlock 双击事件

ops/2024/10/20 16:07:39/

TextBlock双击事件

<DataGridTemplateColumn Width="*" Header="内标"><DataGridTemplateColumn.CellTemplate><DataTemplate><Grid><TextBlockBackground="Transparent"Tag="{Binding InternalId}"Text="{Binding InternalId}"><TextBlock.InputBindings><MouseBindingCommand="{Binding DataContext.InternalClickCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}}"CommandParameter="{Binding}"MouseAction="LeftDoubleClick" /></TextBlock.InputBindings></TextBlock></Grid></DataTemplate></DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

Button点击事件

<DataGridTemplateColumn Width="*" Header="内标"><DataGridTemplateColumn.CellTemplate><DataTemplate><Grid><ButtonBackground="Transparent"BorderBrush="Transparent"Command="{Binding Path=DataContext.InternalClickCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}}"Content="{Binding InternalId}"Tag="{Binding InternalId}" /></Grid></DataTemplate></DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
 [RelayCommand]private void InternalClick(GuantifyCompound guantifyCompound){MessageBox.Show("=InternalClick=" + guantifyCompound.LeftWidth);}

http://www.ppmy.cn/ops/118396.html

相关文章

python的pyinstaller

1、pyinstaller --onefile -w *.py 可以生成可执行文件 -w就是不需要有console窗体出现、 2、 console窗体会出现一些警告。 比如 Warning: QT_DEVICE_PIXEL_RATIO is deprecated. Instead use: QT_AUTO_SCREEN_SCALE_FACTOR to enable platform plugin controlled per-scre…

【STM32】江科大STM32笔记汇总(已完结)

STM32江科大笔记汇总 STM32学习笔记课程简介(01)STM32简介(02)软件安装(03)新建工程(04)GPIO输出(05)LED闪烁& LED流水灯& 蜂鸣器(06)GPIO输入(07)按键控制LED 光敏传感器控制蜂鸣器(08)OLED调试工具(09)OLED显示屏(10)EXTI外部中断(11)对射式红外传感器计次 旋转编码器…

封装axios请求

1、为什么要封装axios 封装axios&#xff0c;对错误信息进行统一处理&#xff0c;能提高代码简洁性&#xff0c;规范代码 2、封装步骤 2.1 创建文件 首先在utils文件夹下新建request.js文件&#xff0c;内容如下。要确保项目已经安装了axios&#xff0c;和element-ui impo…

实现网上超市:SpringBoot技术详解

2 系统开发技术 这部分内容主要介绍本系统使用的技术&#xff0c;包括使用的工具&#xff0c;编程的语言等内容。 2.1 Java语言 Java语言自公元1995年至今&#xff0c;已经超过25年了&#xff0c;依然在软件开发上面有很大的市场占有率。当年Sun公司发明Java就是为了发展一门跨…

【C高级】有关shell脚本的一些练习

目录 1、写一个shell脚本&#xff0c;将以下内容放到脚本中&#xff1a; 2、写一个脚本&#xff0c;包含以下内容&#xff1a; 1、写一个shell脚本&#xff0c;将以下内容放到脚本中&#xff1a; 1、在家目录下创建目录文件&#xff0c;dir 2、dir下创建dir1和dir2 …

pytorch千问模型源码分析

# 规范化技术&#xff0c;旨在替代传统的 Layer Normalization&#xff08;LN&#xff09; # 核心思想是对输入张量的每个样本的每个特征进行规范化&#xff0c;使其均值为 0&#xff0c;方差为 1 class Qwen2RMSNorm(nn.Module): def __init__(self, hidden_size, eps1e-6…

聚势启新 智向未来 | 重庆华阳通用科技有限公司揭牌成立

助推两江新区汽车产业高质量发展 (以下文字内容转载自两江新区网&#xff09; 9月26日&#xff0c;重庆华阳通用科技有限公司&#xff08;华阳通用重庆子公司&#xff09;在两江新区揭牌成立&#xff0c;将致力于智能座舱、智能驾驶两大领域&#xff0c;不断加大技术研发投入…

Spring Boot与GraphQL:现代化API设计

引言 在当今的软件开发领域&#xff0c;构建高效、灵活且易于维护的API是至关重要的。随着微服务架构的流行&#xff0c;RESTful API已经成为Web服务的标准方式之一。然而&#xff0c;随着应用程序变得越来越复杂&#xff0c;REST API的一些局限性开始显现出来。例如&#xff…