WPF如何获取ContextMenu的源控件属性

zhongxc09 zhongxc09 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
有一个DataTemplate是绑定到一个DataView上的,代码如下:
<DataTemplate x:Key="FriendTemplate">
<Grid >
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Label Content="{Binding Path=fusername}" Name="fname" Grid.Row="0"/>
<Label Content="{Binding Path=status}" Name="status" Grid.Row="0" />
</StackPanel>
<Label Content="{Binding Path=remark}" Name="remark" Grid.Row="1"/>
<Grid.ContextMenu>
<ContextMenu Name="rightMenu" StaysOpen="True">
<MenuItem Header="好友资料" Click="MenuItem_Click_ContactInfo" Name="contactInfo" />
</ContextMenu>
</Grid.ContextMenu>
</Grid>
</DataTemplate>
请问在这个contactInfo点击后如何获取那个label的name属性值?
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
zhongxc09
C# 111,130 成员 642,541 内容