How do I make a control fill the whole cell in a ListView (with a GridView)? I've played around with various properties, but the control is always it's minimum size.
Here's my xaml.
<Window x:Class="ListViewUserControlTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ListViewUserControlTest"
Title="Window1" Height="300" Width="300">
<Window.Resources>
<DataTemplate x:Key="UserControlCell">
<Rectangle Fill="Red" HorizontalAlignment="Stretch" MinWidth="10" MinHeight="10" />
</DataTemplate>
</Window.Resources>
<Grid>
<ListView Name="MyListView">
<ListView.View>
<GridView>
<GridViewColumn Width="30" Header="Col1" DisplayMemberBinding="{Binding Name}" />
<GridViewColumn Width="200" Header="Col2" CellTemplate="{StaticResource UserControlCell}" />
</GridView>
</ListView.View>
</ListView>
</Grid>
Edit Sorry I changed the question because I had eliminated the user control as the source of the problem. It happens with any control.