![](/img/trans.png)
[英]WPF Datagrid RowDetailsTemplate visibility bound to a property
[英]Double clicking on WPF datagrid WITH RowDetailsTemplate
我搜索了,没有找到答案。 我有一个数据网格,它利用RowDetailsTemplate显示有关该特定行的一些高级信息。 但是,当用户双击某行时,我想显示一个单独的表单,其中显示了更多详细信息。 我该怎么做?
我忘了提:双击时,我想打开详细信息而不会看到行详细信息模板! – Menashe 1小时前
谢谢!
梅纳什
只需将它们放在一起,它似乎就可以工作了……我在RowDetailsTemplate的网格中添加了MouseDown处理程序:
<Grid>
<DataGrid x:Name="DataGrid1">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding}" />
</DataGrid.Columns>
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<Grid MouseDown="Grid_MouseDown" >
<TextBlock >This</TextBlock>
</Grid>
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</DataGrid>
</Grid>
以及后面的代码:
private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2)
{
//Open the window here
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.