Since we released the first version of the DataGrid in October we have been listening to your feedback and have an early holiday gift to give.
Today we are releasing an updated DataGrid that contains almost 30 fixes to the top issues that we heard, including:
- Rows containing focus no longer disappear when the ItemsSource changes
- ComboBox and other controls opening a popup now work as expected when set as cell content
- DataGrid Selection is preserved when sorting
- Buttons outside the DataGrid work as expected when they are clicked while the DataGrid is in editing mode
- Improved FrozenColumn behavior
- Improved cell currency
- SelectedItem is updated before the CurrentCellChanged event is raised
- Many more...
For the full list of fixes check out this post by Brian Braeckel one of our DataGrid developers.
As a result of these fixes there are several behavioral breaking changes that you should consider before upgrading:
- FrozenColumnCount now takes hidden columns into account. Previously, only the first columns with Visibility set to Visible were included in the range of frozen columns. A column with Visibility set to Collapsed can now be considered frozen even though it isn’t visible. This is to ensure that a column’s DisplayIndex corresponds with the DataGrid’s FrozenColumnCount (i.e. if FrozenColumnCount == 3, columns with DisplayIndex < 3 are considered frozen).
- The DataGrid’s current cell is now kept in sync with an ICollectionView’s notion of currency. Moving the current position or changing the current item of an ICollectionView will now move the current cell and selected item of a DataGrid, and vice versa. For this to work, the DataGrid’s ItemsSource must be set to a collection that fully implements ICollectionView.
- A developer can now programmatically reorder a non-frozen column to the frozen column range (and vice versa) by changing a column’s DisplayIndex. The DataGrid used to throw an exception in these cases. An end-user, however, is still unable to do this through the UI by dragging column headers.
Visit the Silverlight 2 DataGrid December 2008 Release download page and follow the installation instructions carefully.
In order to use the new DataGrid you need to do all of the following:
- Close all instances of Microsoft Visual Studio.
- Delete all cached toolbox items by removing all files beginning with "toolbox" from %LocalAppData%\Microsoft\VisualStudio\9.0.
- On Microsoft Windows XP, %LocalAppData% is Documents and Settings\UserName\Local Settings\Application Data.
- On Microsoft Windows Vista, %LocalAppData% is Users\UserName\AppData\Local.
- Replace the following assemblies with the ones contained in the package in the link above:
- %ProgramFiles%\Microsoft SDKs\Silverlight\v2.0\Libraries\Client\System.Windows.Controls.Data.dll
- %ProgramFiles%\Microsoft SDKs\Silverlight\v2.0\Libraries\Client\System.Windows.Controls.Data.Design.dll
- For any existing projects, delete the reference to System.Windows.Controls.Data.dll and then re-add the reference.
We hope you enjoy the update and we look forward to bringing great new things to future versions of the DataGrid.