views:

23

answers:

0

I have a DataGrid that I have bound to a property:

<cd:DataGrid 
    Name="myDataGrid"
    ItemsSource="{Binding Mode=OneWay,Path=Thingies}"
    VerticalScrollBarVisibility="Auto" 
    HorizontalScrollBarVisibility="Auto">
...

When the Thingies property changes, once all rows in the DataGrid have been populated with the new contents of Thingies, I want the DataGrid to scroll to the bottom row.

In WinForms, I would have done this by subscribing to the DataBindingComplete event. MSDN Forums contains several suggestions on how to do this with Silverlight 4.0 but they range from completely evil to just plain fugly:

  • start a 100ms timer on load, and scroll when it elapses
  • count rows as they're added, and scroll to the bottom when the number of added rows equals the number of entities in the data source

Is there an idiomatic, elegant way of doing what I want in Silverlight 4.0?