![](/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.