[英]Wpf GridView multi-row entry
我正在研究WPF
應用程序。 我需要制作一個GridView
。 但是有一個條件:每行實際上應該是兩行,第一行包含3列。 喜歡:
| cell1 | cell2 | cell3 |
| cell4 |
項目類是
Data{string id, string Name, string type, string Path}
在這種情況下:路徑太長所以我應該在整行顯示它。 我怎樣才能做到這一點?
您可以使用帶有RowDetails的Datagrid始終可見,例如:
<DataGrid ItemsSource="{Binding YourItemSource}" RowDetailsVisibilityMode="Visible">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding id}" Header="Id" />
<DataGridTextColumn Binding="{Binding Name}" Header="Name" />
<DataGridTextColumn Binding="{Binding Type}" Header="Type" />
</DataGrid.Columns>
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path}" />
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</DataGrid>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.