我在使用TextWrapping在此示例中工作时遇到问题。谁能看到我在这里做错了什么?
<ListView Name="listViewReportedException" ItemsSource="{Binding ExceptionDetails}">
<ListView.View>
<GridView>
<GridViewColumn Header="Time" DisplayMemberBinding="{Binding Thrown}" Width="150" />
<GridViewColumn Header="Description" DisplayMemberBinding="{Binding Description}" Width="385">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock TextWrapping="Wrap" Text="{Binding}" Width="385"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Recover action" DisplayMemberBinding="{Binding Action}" Width="90"/>
</GridView>
</ListView.View>
</ListView>
答案 0 :(得分:30)
您正在同时设置DisplayMemberBinding
和CellTemplate
。使用DisplayMemberBinding
时删除CellTemplate
。同时删除Width
的{{1}},它也会正常工作
TextBlock