Although every attempt was made to prevent breaking interface changes between versions 1.x and 2.0, some were inevitable. This topic describes the most notable changes, how to migrate existing code, as well as provides a list of the members that were rendered obsolete.
The most notable interface change between version 1.x and 2.0 relates to how group configurations are provided. In previous versions, group configurations were provided per group level by adding GroupLevelConfiguration objects to a view's GroupLevelConfigurations collection. In version 2.0, group configurations can be provided through the DefaultGroupConfiguration property, which provides a default group configuration that will be applied to any groups in a grid for which an explicit group configuration is not provided, and/or through the GroupConfigurationSelector property, which selects the appropriate configuration for a group based on any desired criteria. Both these properties are defined on the DataGridControl class as well as on the DetailConfiguration and DefaultDetailConfiguration classes.
Although custom group configuration selectors can be created, version 2.0 provides two built-in configuration selectors: FieldNameGroupConfigurationSelector and LevelGroupConfigurationSelector. The FieldNameGroupConfigurationSelector selects the appropriate group configuration for a group based on the column field names provided by the FieldNameGroupConfigurationSelectorItems it contains while the LevelGroupConfigurationSelector selects the configuration based on the group levels provided by its LevelGroupConfigurationSelectorItems and is the direct replacement for the obsoleted GroupLevelConfigurations. Both built-in selectors can be used in XAML.
GroupLevelConfiguration to LevelGroupConfigurationSelector Migration Example
Group configurations in version 1.x
XAML |
Copy Code |
---|---|
<xcdg:DataGridControl x:Name="OrdersGrid" ItemsSource="{Binding Source={StaticResource cvs_orders}}"> <xcdg:DataGridControl.View> <xcdg:TableView> <xcdg:TableView.GroupLevelConfigurations> <!--The configuration that will be applied to all first-level groups--> <xcdg:GroupLevelConfiguration InitiallyExpanded="False"> <xcdg:GroupLevelConfiguration.Footers> <xcdg:GroupHeaderFooterItemTemplate VisibleWhenCollapsed="True"> <DataTemplate> <xcdg:InsertionRow/> </DataTemplate> </xcdg:GroupHeaderFooterItemTemplate> </xcdg:GroupLevelConfiguration.Footers> </xcdg:GroupLevelConfiguration> <!--The default configuration will be applied to all other group levels.--> <xcdg:GroupLevelConfiguration/> </xcdg:TableView.GroupLevelConfigurations> </xcdg:TableView> </xcdg:DataGridControl.View> </xcdg:DataGridControl> |
Group configurations as of version 2.0
XAML |
Copy Code |
---|---|
<xcdg:DataGridControl.GroupConfigurationSelector> <xcdg:LevelGroupConfigurationSelector> <!--The configuration that will be applied to all first-level groups. There is no need to specify a default group configuration since the built-in one will be used. --> <xcdg:LevelGroupConfigurationSelectorItem Level="0"> <xcdg:LevelGroupConfigurationSelectorItem.GroupConfiguration> <xcdg:GroupConfiguration InitiallyExpanded="False" UseDefaultHeadersFooters="True"> <xcdg:GroupConfiguration.Headers> <xcdg:GroupHeaderFooterItemTemplate VisibleWhenCollapsed="True"> <DataTemplate> <xcdg:InsertionRow Background="HotPink"/> </DataTemplate> </xcdg:GroupHeaderFooterItemTemplate> </xcdg:GroupConfiguration.Headers> </xcdg:GroupConfiguration> </xcdg:LevelGroupConfigurationSelectorItem.GroupConfiguration> </xcdg:LevelGroupConfigurationSelectorItem> </xcdg:LevelGroupConfigurationSelector> </xcdg:DataGridControl.GroupConfigurationSelector> |
Group configurations as of version 6.2
XAML |
Copy Code |
---|---|
<xcdg:DataGridControl.GroupConfigurationSelector> <xcdg:LevelGroupConfigurationSelector> <!--The configuration that will be applied to all first-level groups. There is no need to specify a default group configuration since the built-in one will be used. --> <xcdg:LevelGroupConfigurationSelectorItem Level="0"> <xcdg:LevelGroupConfigurationSelectorItem.GroupConfiguration> <xcdg:GroupConfiguration InitiallyExpanded="False" DefaultHeadersFootersType="GroupHeaderControl"> <xcdg:GroupConfiguration.Headers> <xcdg:GroupHeaderFooterItemTemplate VisibleWhenCollapsed="True"> <DataTemplate> <xcdg:InsertionRow Background="HotPink"/> </DataTemplate> </xcdg:GroupHeaderFooterItemTemplate> </xcdg:GroupConfiguration.Headers> </xcdg:GroupConfiguration> </xcdg:LevelGroupConfigurationSelectorItem.GroupConfiguration> </xcdg:LevelGroupConfigurationSelectorItem> </xcdg:LevelGroupConfigurationSelector> </xcdg:DataGridControl.GroupConfigurationSelector> |
Another change is the obsoletion of the ClearHeadersFooters markup extension that, when added to a header or footer section (in XAML), cleared the content of the section to which it was added. As of version 2.0, the UseDefaultHeadersFooters property, which is defined on the View, GroupConfiguration, DetailConfiguration, and DefaultDetailConfiguration classes, can be used to clear the content of the header and footer sections.
For more information on group configurations, refer to the Group Configurations topic.
The DataGridCollectionViewSource class now derives from CollectionViewSource; therefore, its Filter event is that of the base class which uses the standard FilterEventArgs.
The following table provides a list of the members that were rendered obsolete and their replacement.
Obsolete member | Replacement member | Type |
---|---|---|
DataGridCollectionView( Type ) constructor | None | Error |
DataGridCollectionView.View property | None | Error |
DataGridCollectionViewSource.SourceItems property | DataGridCollectionViewSource.Source property | Error |
DataGridItemProperty.AutoFilterValues property | DataGridCollectionView.AutoFilterValues property | Error |
Column.DistinctValues property | DataGridCollectionView.DistinctValues property | Error |
Column.AutoFilterIndex property | AutoFilterControl.AutoFilterIndex property | Error |
Column.AutoFilterValues property | DataGridCollectionView.AutoFilterValues property | Error |
Column.ParentDataGridControl property | DataGridControl.GetParentDataGridControl method | Error |
DataGridControl.ItemContainerGenerator property | DataGridControl.GetContainerFromItem method DataGridControl.GetItemFromContainer method |
Error |
DataGridControl.ViewBindingContext property | DataGridControl.DataGridContext attached property | Warning |
GroupLevelConfiguration class (and all members) | LevelGroupConfigurationSelectorItem class | Error |
GroupLevelConfigurationCollection class | LevelGroupConfigurationSelector class | Error |
ClearGroupLevelConfigurations class | None | Error |
ClearHeadersFooters class | ViewBase.UseDefaultHeadersFooters property GroupConfiguration.UseDefaultHeaderFooters property |
Error |
ViewBase.GroupLevelConfigurations property | DataGridControl.DefaultGroupConfiguration property DataGridControl.GroupConfigurationSelector property |
Error |