开发者

Double clicking on WPF datagrid WITH RowDetailsTemplate

I have searched a开发者_如何学Gond searched and found no answer. I have a datagrid which utilizes the RowDetailsTemplate to display some higher-level information about that particular row. However, when the user double clicks on a row, I would like to display a separate form which displays much more detailed information. How can I accomplish this?

I forgot to mention: On double click, I want to open the detail WITHOUT seeing the row details template! – Menashe 1 hour ago

Thanks!

Menashe


Just put this together and it seemed to work... I added a MouseDown handler to the grid in the RowDetailsTemplate:

<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>

And the code behind:

private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
{
    if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2)
    {
       //Open the window here
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜