首页 > TAG信息列表 > CommandParameter
WPF 踩坑笔记4 Prism 文本框回车事件
<TextBox Name="xx" > <TextBox.InputBindings> <KeyBinding Command="{Binding MyCommand}" Key="Enter" CommandParameter="{Binding ElementName=xx}"/> </TextBox.InputBindings> <WPF CommandParameter的使用
参考网址:https://www.cnblogs.com/dxmfans/p/9434612.html <Window x:Class="Wpf180706.Window5" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"WPF中Command和CommandParameter绑定写法
<Button Content="操作" Command="{Binding 命令名称}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedItem}" /> RelativeSource可以将某个控件作为参数转递给Comm