我有一个列表视图,当我手动调整列宽时,整个列表视图变得更大,到目前为止一切都很好。但是当我缩小列时,列表视图仍然保持宽度。列表视图是否也可能随着列宽而缩小?
下面是一个简单的例子:
<Grid>
<Grid.Resources>
<XmlDataProvider x:Key="Data">
<x:XData>
<Data xmlns="">
<Item ID="1"/>
<Item ID="2"/>
<Item ID="3"/>
</Data>
</x:XData>
</XmlDataProvider>
</Grid.Resources>
<ScrollViewer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ListView DataContext="{Binding Source={StaticResource Data}, XPath=/Data}"
ItemsSource="{Binding XPath=Item}" SelectionMode="Single">
<ListView.View>
<GridView>
<GridViewColumn Header="ID" DisplayMemberBinding="{Binding XPath=@ID}"/>
</GridView>
</ListView.View>
</ListView>
<TextBlock Text="Test" Grid.Column="1"/>
</Grid>
</ScrollViewer>
</Grid>