当我向左或向右拖动GridSplitter时,我试图动态调整ListView中列的大小。我尝试的一切都无济于事。这些列保持不变,我将右网格列拖到ListView上方。有人可以建议如何做到这一点吗?
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="350"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ListView ItemsSource="{Binding ProductsView}" SelectedItem="{Binding SelectedProduct}" FontSize="16" Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="2" VerticalAlignment="Top">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="VerticalContentAlignment" Value="Top" />
<Setter Property="BorderBrush" Value="Black"></Setter>
<Setter Property="BorderThickness" Value="0,0,0,1"></Setter>
</Style>
</ListView.ItemContainerStyle>
<ListView.View>
<GridView >
<GridView.Columns >
<GridViewColumn >
<GridViewColumn.CellTemplate>
<DataTemplate >
<Image Source="{Binding Path=PicturePreview, IsAsync=True}" Height="100" Width="100" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Color" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Color}" Margin="5,5,5,5"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="ItemNumber" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding ItemNumber}" Margin="5,5,5,5"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView.Columns>
</GridView>
</ListView.View>
</ListView>
<GridSplitter Grid.Column="3" Grid.Row="2" VerticalAlignment="Stretch" HorizontalAlignment="Center" Width="25" ResizeDirection="Columns"></GridSplitter>
</Grid>