使用扩展器展开和折叠行详细信息。 [英] Using an expander to expand and collapse the row details.
本文介绍了使用扩展器展开和折叠行详细信息。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我上传的示例项目在的 WpfApp1。在OneDrive上压缩。
I uploaded a sample project at WpfApp1.zip on OneDrive.
关键点是点击该行以显示行详细信息。
The key point is to click the row to show the row details.
<Grid Margin="10">
<DataGrid Name="dgUsers" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding Name}" />
<DataGridTextColumn Header="Birthday" Binding="{Binding Birthday}" />
</DataGrid.Columns>
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<TextBlock Text="{Binding Details}" Margin="10" />
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</DataGrid>
</Grid>
但是我的任务有点不同。在DataGrid中,我们只显示摘要。当在文本块中显示细节时,它显示一个扩展器。单击它然后显示详细信息。再次单击它(折叠,它将隐藏整个细节(textblock )。
我无法做到这一点。
推荐答案
我不确定我是否按照你想要的方式行事。
I'm not sure I follow what you want to do.
你只想要在行尾的扩展器与里面的文本块?
You just want an expander in the rowdetails with the textblock inside it?
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<Expander>
<TextBlock Text="{Binding Details}" Margin="10" />
</Expander>
</DataTemplate>
</DataGrid.RowDetailsTemplate>
这篇关于使用扩展器展开和折叠行详细信息。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文