Skip to main content

Migrating from Version 1.x

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.

Breaking Interface Changes - Group Configurations

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.

Group configurations in version 1.x

<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

<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

<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.

tip

Setting the UseDefaultHeaderFooters property to false will exclude the default header and footer items from both the header and footer sections. If left to true (default) items added to the header and footer section will be added after the default items.

For more information on group configurations, refer to the Group Configurations topic.

DataGridCollectionViewSource Class

The DataGridCollectionViewSource class now derives from CollectionViewSource; therefore, its Filter event is that of the base class which uses the standard FilterEventArgs.

Obsolete Members

The following table provides a list of the members that were rendered obsolete and their replacement.

Obsolete memberReplacement memberType
DataGridCollectionView( Type ) constructorNoneError
DataGridCollectionView.View propertyNoneError
DataGridCollectionViewSource.SourceItems propertyDataGridCollectionViewSource.Source propertyError
DataGridItemProperty.AutoFilterValues propertyDataGridCollectionView.AutoFilterValues propertyError
Column.DistinctValues propertyDataGridCollectionView.DistinctValues propertyError
Column.AutoFilterIndex propertyAutoFilterControl.AutoFilterIndex propertyError
Column.AutoFilterValues propertyDataGridCollectionView.AutoFilterValues propertyError
Column.ParentDataGridControl propertyDataGridControl.GetParentDataGridControl methodError
DataGridControl.ItemContainerGenerator propertyDataGridControl.GetContainerFromItem method DataGridControl.GetItemFromContainer methodError
DataGridControl.ViewBindingContext propertyDataGridControl.DataGridContext attached propertyWarning
GroupLevelConfiguration class (and all members)LevelGroupConfigurationSelectorItem classError
GroupLevelConfigurationCollection classLevelGroupConfigurationSelector classError
ClearGroupLevelConfigurations classNoneError
ClearHeadersFooters classViewBase.UseDefaultHeadersFooters property GroupConfiguration.UseDefaultHeaderFooters propertyError
ViewBase.GroupLevelConfigurations propertyDataGridControl.DefaultGroupConfiguration property DataGridControl.GroupConfigurationSelector propertyError