CompactCardView Class
See Also  Members   Example 
Xceed.Wpf.DataGrid Assembly > Xceed.Wpf.DataGrid.Views Namespace : CompactCardView Class

Represents a compact card-view layout. The compact card-view layout applies well when a database has many columns but few of the fields contain data. In this case, the fields that do not contain data will not be displayed in the cards, giving them a more compact appearance.

Object Model


Syntax

Visual Basic (Declaration) 
Public Class CompactCardView 
   Inherits CardView
   Implements ISupportInitializeIFrameworkInputElementIInputElementIAnimatable 
C# 
public class CompactCardView : CardView, ISupportInitializeIFrameworkInputElementIInputElementIAnimatable  

Example

All examples in this topic assume that the grid is bound to the Orders table of the Northwind database, unless stated otherwise.
The following examples demonstrates how to use attribute syntax to apply a card-view layout, with the normal-color Aero theme, to a grid.
XAMLCopy Code
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"> 
  <Grid.Resources> 
    <xcdg:DataGridCollectionViewSource x:Key="cvs_orders" 
                                    Source="{Binding Source={x:Static Application.Current}, 
                                                      Path=Orders}"/> 
  </Grid.Resources> 
 
  <xcdg:DataGridControl x:Name="OrdersGrid" 
                        ItemsSource="{Binding Source={StaticResource cvs_orders}}" 
                        View="CardView.Zune.NormalColor"/> 
</Grid>
The following examples demonstrates how to use property element syntax to apply a card-view layout, with the normal-color Aero theme, to a grid.
XAMLCopy Code
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"> 
  <Grid.Resources> 
    <xcdg:DataGridCollectionViewSource x:Key="cvs_orders" 
                                     Source="{Binding Source={x:Static Application.Current}, 
                                                      Path=Orders}"/> 
  </Grid.Resources> 
   <xcdg:DataGridControl x:Name="OrdersGrid" 
                         ItemsSource="{Binding Source={StaticResource cvs_orders}}"> 
 
     <xcdg:DataGridControl.View> 
        <xcdg:CardView> 
           <xcdg:CardView.Theme> 
              <xcdg:ZuneNormalColorTheme/> 
           </xcdg:CardView.Theme> 
        </xcdg:CardView> 
     </xcdg:DataGridControl.View> 
   </xcdg:DataGridControl> 
</Grid>
The following example demonstrates how to apply one of the custom background brushes (provided by Xceed) cards (i.e., data rows) by creating an implicit style that targets DataRow and that sets the background property.
XAMLCopy Code
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"> 
    <Grid.Resources> 
       <xcdg:DataGridCollectionViewSource x:Key="cvs_products" 
                                    Source="{Binding Source={x:Static Application.Current}, Path=ProductsTable}"/> 
      <Style TargetType="{x:Type xcdg:DataRow}"> 
         <Setter Property="Background" 
                 Value="{x:Static xcdg:CardBackgroundBrushes.Retro}"/> 
      </Style>   
    </Grid.Resources> 
    <xcdg:DataGridControl x:Name="ProductsGrid" 
                          ItemsSource="{Binding Source={StaticResource cvs_products}}"> 
       <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:CardflowView3D.Theme> 
          </xcdg:CardflowView3D>            
       </xcdg:DataGridControl.View> 
    </xcdg:DataGridControl> 
 </Grid>

Remarks

The View property of the DataGridControl class determines which view is applied to a grid. If the View property is left to its default value, null (Nothing in Visual Basic), or explicitly set to null, the default table-view layout will be used with the system color scheme. The Theme property of the View class can be set to change the color scheme applied to a grid's elements. If left to its default value, null, the system color scheme will be used. In either case, if the system-color theme is not recognized (e.g., a third-party color scheme is being used), the Aero normal-color theme will be used.

Views and themes can be set through attribute syntax or property element syntax. To change the default view and/or theme using attribute syntax, the name of the view to use (e.g., CardView) must be provided, optionally followed by the name of the theme class (e.g., NormalColorTheme), or the name of the class without the "Theme" portion. If the theme is omitted, the default Aero normal-color theme will be used.

Inheritance Hierarchy

System.Object
   System.Windows.Threading.DispatcherObject
      System.Windows.DependencyObject
         System.Windows.ContentElement
            System.Windows.FrameworkContentElement
               Xceed.Wpf.DataGrid.Views.ViewBase
                  Xceed.Wpf.DataGrid.Views.UIViewBase
                     Xceed.Wpf.DataGrid.Views.CardView
                        Xceed.Wpf.DataGrid.Views.CompactCardView

Requirements

Supported Operating Systems: Windows Server 2003 Service Pack 1; Windows Vista; Windows XP Service Pack 2

See Also