I'm having problems getting a Silverlight DataGrid to stretch to accommodate all the items in it's dataSource. I've got a Grid that contains two DataGrids. I've tried setting height=Auto on the Grid and the DataGrids. I've tried setting HorizontalContentAlignment="Stretch" on the Grid and the DataGrids. The object tag has height="100%" I've set the Height="*" on the RowDefinitions for the Grid
Any help would be very much appreciated!
Here's the code listing:
<UserControl x:Class="TimeSheet.SilverLight.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
mc:Ignorable="d">
<Grid x:Name="LayoutRoot" Height="Auto" ShowGridLines="True" HorizontalAlignment="Stretch" >
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<local:DataGrid BorderThickness="5" HorizontalContentAlignment="Stretch" AutoGenerateColumns="False" VerticalAlignment="Top" x:Name="NonProjectGrid" Grid.Row="0">
<local:DataGrid.Columns>
<local:DataGridTextColumn Header="Activity" Binding="{Binding TaskName}" />
<local:DataGridTextColumn Header="Monday" Binding="{Binding Monday, Mode=TwoWay}" />
<local:DataGridTextColumn Header="Tuesday" Binding="{Binding Tuesday, Mode=TwoWay}" />
<local:DataGridTextColumn Header="Wednesday" Binding="{Binding Wednesday, Mode=TwoWay}" />
<local:DataGridTextColumn Header="Thursday" Binding="{Binding Thursday, Mode=TwoWay}" />
<local:DataGridTextColumn Header="Friday" Binding="{Binding Friday, Mode=TwoWay}" />
<local:DataGridTextColumn Header="Saturday" Binding="{Binding Saturday, Mode=TwoWay}" />
<local:DataGridTextColumn Header="Sunday" Binding="{Binding Sunday, Mode=TwoWay}" />
</local:DataGrid.Columns>
</local:DataGrid>
<local:DataGrid BorderThickness="5" HorizontalContentAlignment="Stretch" AutoGenerateColumns="False" VerticalAlignment="Top" x:Name="ProjectGrid" Grid.Row="2">
<local:DataGrid.Columns>
<local:DataGridTextColumn Header="Bug Number" Binding="{Binding BugNo}" />
<local:DataGridTextColumn Header="Activity" Binding="{Binding TaskName}" />
<local:DataGridTextColumn Header="Monday" Binding="{Binding Monday, Mode=TwoWay}" />
<local:DataGridTextColumn Header="Tuesday" Binding="{Binding Tuesday, Mode=TwoWay}" />
<local:DataGridTextColumn Header="Wednesday" Binding="{Binding Wednesday, Mode=TwoWay}" />
<local:DataGridTextColumn Header="Thursday" Binding="{Binding Thursday, Mode=TwoWay}" />
<local:DataGridTextColumn Header="Friday" Binding="{Binding Friday, Mode=TwoWay}" />
<local:DataGridTextColumn Header="Saturday" Binding="{Binding Saturday, Mode=TwoWay}" />
<local:DataGridTextColumn Header="Sunday" Binding="{Binding Sunday, Mode=TwoWay}" />
</local:DataGrid.Columns>
</local:DataGrid>
<Button Name="AddBugBtn" Width="125" Height="25" Content="Add From Bugzilla" Click="AddBug_Click" Grid.Row="3" HorizontalAlignment="Right"></Button>
<Button Name="SaveBtn" Width="125" Height="25" Content="Save" Click="Save_Click" Grid.Row="3" HorizontalAlignment="Left"></Button>
</Grid>