Xceed DataGrid for WPF v7.2 Documentation
GetCoercedSurfaceConfiguration Method
Example 


Xceed.Wpf.DataGrid Assembly > Xceed.Wpf.DataGrid.Views.Surfaces Namespace > MultiSurfaceViewBase Class : GetCoercedSurfaceConfiguration Method
The dependency object from which the property value is read.
Gets the surface configuration that is applied to a card (i.e., row).
Syntax
'Declaration
 
Public Shared Function GetCoercedSurfaceConfiguration( _
   ByVal obj As DependencyObject _
) As SurfaceConfiguration
'Usage
 
Dim obj As DependencyObject
Dim value As SurfaceConfiguration
 
value = MultiSurfaceViewBase.GetCoercedSurfaceConfiguration(obj)
public static SurfaceConfiguration GetCoercedSurfaceConfiguration( 
   DependencyObject obj
)

Parameters

obj
The dependency object from which the property value is read.

Return Value

A reference to the the SurfaceConfiguration that is applied to a card (i.e., row).
Remarks
Setting the CoercedSurfaceConfiguration property to a null reference (Nothing in Visual Basic), will result in an empty surface being displayed.
Example
All examples in this topic assume that the grid is bound to the Products table of the Northwind database, unless stated otherwise.
The following example demonstrates how to apply a different surface configuration on the back surface of the center card using the CoercedSurfaceConfiguration attached property.The following example demonstrates how to apply a different surface configuration on the back surface of the center card using the CoercedSurfaceConfiguration attached property.The following XAML demonstrates how to define the initial surface configurations that are applied to various surfaces.
Private m_fullSurfaceConfiguration As New ImageAndDataSurfaceConfiguration()
Private Sub ApplyCoercedSurfaceConfiguration( ByVal sender As Object, ByVal e As RoutedEventArgs )
  If Not Me.ProductsGrid.CurrentItem Is Nothing Then
    Dim card As Xceed.Wpf.DataGrid.DataRow = CType( Me.ProductsGrid.GetContainerFromItem( _
                                         Me.ProductsGrid.CurrentItem ), Xceed.Wpf.DataGrid.DataRow )
    If Not card Is Nothing Then
       card.SetValue( MultiSurfaceViewBase.CoercedSurfaceConfigurationProperty, m_fullSurfaceConfiguration )
    End If
  End If
End Sub
Private ImageAndDataSurfaceConfiguration m_fullSurfaceConfiguration = New ImageAndDataSurfaceConfiguration();
Private void ApplyCoercedSurfaceConfiguration( Object sender, RoutedEventArgs e )
{
  If( this.ProductsGrid.CurrentItem != null )
  {
   Xceed.Wpf.DataGrid.DataRow card = this.ProductsGrid.GetContainerFromItem(
                                        this.ProductsGrid.CurrentItem ) As Xceed.Wpf.DataGrid.DataRow;
   If( card != null )
   {
     card.SetValue( MultiSurfaceViewBase.CoercedSurfaceConfigurationProperty, m_fullSurfaceConfiguration );
   }
  }
}
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid">     
  <Grid.RowDefinitions>
     <RowDefinition Height="Auto"/>
     <RowDefinition/>
  </Grid.RowDefinitions>
  <Grid.Resources>
    
     <xcdg:DataGridCollectionViewSource x:Key="cvs_products"
                                    Source="{Binding Source={x:Static Application.Current}, Path=ProductsTable}"/>
  </Grid.Resources>
  <Button Content="Coerce Surface Configuration"
          Click="ApplyCoercedSurfaceConfiguration"
          Grid.Row="0"/>
  <xcdg:DataGridControl x:Name="ProductsGrid"
                        ItemsSource="{Binding Source={StaticResource cvs_products}}"
                        Grid.Row="1">
     <xcdg:DataGridControl.Columns>
        <xcdg:Column FieldName="ProductName"
                     IsMainColumn="True"/>
     </xcdg:DataGridControl.Columns>
    <xcdg:DataGridControl.View>
       <xcdg:CardflowView3D CardHeightToViewportRatio="0.5">
          <xcdg:CardflowView3D.Theme>
             <xcdg:ElementalBlackTheme>
                <xcdg:ElementalBlackTheme.SurfaceConfigurations>
                   <xcdg:ImageSurfaceConfiguration xcdg:CardflowView3D.Surfaces="Left, Right"/>

                   <xcdg:ImageAndTitleSurfaceConfiguration xcdg:CardflowView3D.Surfaces="Center"/>

                   <xcdg:CompleteSurfaceConfiguration xcdg:CardflowView3D.Surfaces="Back"
                                                      AutoFillDefaultRegion="False">
                      <xcdg:CompleteSurfaceConfiguration.DataRegionConfiguration>
                         <xcdg:RegionConfiguration FieldNames="ProductID, UnitPrice, UnitsInStock"/>
                      </xcdg:CompleteSurfaceConfiguration.DataRegionConfiguration>                      
                   </xcdg:CompleteSurfaceConfiguration>
                </xcdg:ElementalBlackTheme.SurfaceConfigurations>
             </xcdg:ElementalBlackTheme>
          </xcdg:CardflowView3D.Theme>
       </xcdg:CardflowView3D>           
    </xcdg:DataGridControl.View>
  </xcdg:DataGridControl>
</Grid>
Requirements

Target Platforms: Windows 11, Windows, 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

MultiSurfaceViewBase Class
MultiSurfaceViewBase Members