In the next .NET 3.5 XAML, if you drag the column width of the Day column wider, the ListView grows great to take this into account. However, if you then drag the column width, the table will remain the same.
The same problem exists vertically. If some of your columns have word wraps, the table will be higher to handle this, but then not shrink.
It's really dumb here. If you delete the ListView.ItemsSource section, then the ListView works as you wish! Why will this affect this?
Any ideas?
<Window x:Class="TestWpfTables.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System.Collections;assembly=mscorlib" xmlns:p="clr-namespace:System;assembly=mscorlib" Title="Window1" Height="300" Width="300"> <Grid> <ListView HorizontalAlignment="Left"> <ListView.View> <GridView> <GridViewColumn DisplayMemberBinding="{Binding Path=Day}" Header="Day" /> </GridView> </ListView.View> <ListView.ItemsSource> <s:ArrayList> <p:DateTime>1990/1/1 12:22:02</p:DateTime> <p:DateTime>1990/1/2 13:2:01</p:DateTime> <p:DateTime>1990/1/5 2:1:6</p:DateTime> </s:ArrayList> </ListView.ItemsSource> </ListView> </Grid> </Window>
source share