SL Entity Relationship Example - Scroll

Hi,

Last one for today. How can I get the column list to scroll?

Thanks
Rich

In Silverlight, it’s using a DataGrid, which already knows how to scroll. So you just need to restrict its height.

In this sample I shouldn’t have used a StackPanel, because interactive resizing of the node wouldn’t constraint the height of the DataGrid appropriately. Try this instead:

<DataTemplate x:Key="NodeTemplate"> <Border Background="Gray" BorderBrush="Gray" BorderThickness="2" CornerRadius="3" go:Part.SelectionAdorned="True" go:Part.Resizable="True" go:Node.FromSpot="AllSides" go:Node.ToSpot="AllSides" go:Node.Location="{Binding Path=Data.Location, Mode=TwoWay}"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <TextBlock Grid.Column="0" HorizontalAlignment="Center" Text="{Binding Path=Data.Key}" FontWeight="Bold" /> <Button Grid.Column="1" Content="*" Click="Button_Click" /> </Grid> <grid:DataGrid Grid.Row="1" AutoGenerateColumns="False" Background="White" HorizontalAlignment="Stretch" ItemsSource="{Binding Path=Data.Items}"> <grid:DataGrid.Columns> <grid:DataGridTemplateColumn> <grid:DataGridTemplateColumn.CellTemplate> <DataTemplate> <go:NodePanel> <Path go:NodePanel.Figure="{Binding Path=Figure}" Width="10" Height="10" Fill="{Binding Path=Color, Converter={StaticResource theStringBrushConverter}}" Stroke="Black" StrokeThickness="1" /> </go:NodePanel> </DataTemplate> </grid:DataGridTemplateColumn.CellTemplate> </grid:DataGridTemplateColumn> <grid:DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" /> </grid:DataGrid.Columns> </grid:DataGrid> </Grid> </Border> </DataTemplate>
This is the sample template as before, but replaces the StackPanel with another Grid.