Silverlight 4 Scrolling Grid with Fixed Header

After much searching and frustration I have come up with a solution of how to render a Grid in Silverlight with a fixed header, other solutions I have come across did not meet my requirements as the grid in question is built dynamically in code do to requirements. Anyway the solution use two grids! Simple really.

I have created a container grid to hold both the header and body grids, this has two row definitions the first has a height of Auto for the header the second is left to resize to the container. The first row contains my header grid and the second row contains a scrollviewer inside of which is the body grid. To get all the columns to line up correctly between the grids I have found it is required to set the border thickness and padding of the scrollviewer to 0.


        <RowDefinition Height="Auto"></RowDefinition>
    <Grid Grid.Row="0" x:Name="LayoutHeader"></Grid>
    <ScrollViewer Grid.Row="1" BorderThickness="0" Padding="0">
        <Grid x:Name="LayoutBody"></Grid>


In the code behind where the columndefinitions are dynamically created they are now added to both the header and body grids. After both grids have been generated I have added a handler for the sizechanged of the body grid.

this.LayoutBody.SizeChanged += new SizeChangedEventHandler(LayoutBody_SizeChanged);

This then loops through the body columndefinitions and sets the matching columndefinition width of the header to the actualwidth of the body columndefinition.

void LayoutBody_SizeChanged(object sender, SizeChangedEventArgs e)
    int index = 0;
    foreach (ColumnDefinition def in LayoutBody.ColumnDefinitions)
        LayoutHeader.ColumnDefinitions[index].Width = new GridLength(def.ActualWidth);


I am not suggesting this will be the best solution for all but for me it saved a really big headache and appears to have no performance issues with rendering or resizing, I hope someone else fins this useful.

TS: Microsoft SharePoint 2010 Configuring – Exam 70-667 Passed!

I have just passed the 70-667 exam and I can say I was suprised by the breath of the questions within. I think anyone involved with day to day administration of SharePoint 2010 would pass with only a little effort and study. However as a SharePoint developer there were many areas that proved difficult, particularly as I primarily deal with SharePoint Foundation rather than the full blown server version. For anyone in the same position I would recommend covering the following topics in depth:

  • Form Services
  • Excel Services
  • Powershell command (you really need to be aware of the specific commands available and when to use them)
  • Backup and Restore (not just for content databases but for lists/sites/excel services)
  • Security (no gotchas here general knowledge will get you through)
I woud say the exam is definately worth taking as a dev as it makes you much more aware of SharePoints architecture (sometimes painfully so) and how best to develop solutions within it. I would also recommend getting a study guide book as I ended up borrowing one after discovering I was studying most areas in too much depth but not covering the breath of knowledge required.
Anyway it is all behind me now and I will be looking at the developer exam in the new year to anyone else looking to take it, Good Luck!