Version

About Card Settings

The CardViewSettings object exposes several properties that allow you to modify the layout and behavior of cards. For example, you can set the height and width of cards, the orientation of cards, the visibility of card headers, etc. For a list of commonly used properties exposed by the CardViewSettings objects, see the Remarks section in the API Reference Guide.

Once you understand how a property exposed by the CardViewSettings object affects the layout or behavior of cards in the xamDataCards™ control, you can leverage the same knowledge when working with the xamDataPresenter control in card view. The only difference between xamDataCards and xamDataPresenter in card view is the way you access the CardViewSettings object.

When using the xamDataCards control, you can access the CardViewSettings object directly through the xamDataCards ViewSettings property. However, when using the xamDataPresenter control in card view, you must cast xamDataPresenter’s View property to an instance of a CardView object first. After casting successfully, you can access the CardViewSettings object through the CardView object’s ViewSettings property.

The following example code demonstrates the same CardViewSettings properties being set, but on the xamDataCards control and the xamDataPresenter control in card view.

In XAML:

<!--xamDataCards-->
<igDP:XamDataCards Name="xamDataCards1">
    <igDP:XamDataCards.ViewSettings>
        <igDP:CardViewSettings ShouldCollapseEmptyCells="True" />
    </igDP:XamDataCards.ViewSettings>
</igDP:XamDataCards>
<!--xamDataPresenter-->
<igDP:XamDataPresenter Name="xamDataPresenter1">
    <!--If you do not set the View property, xamDataPresenter automatically uses a GridView object-->
    <igDP:XamDataPresenter.View>
        <igDP:CardView>
            <igDP:CardView.ViewSettings>
                <igDP:CardViewSettings ShouldCollapseEmptyCells="True" />
            </igDP:CardView.ViewSettings>
        </igDP:CardView>
    </igDP:XamDataPresenter.View>
</igDP:XamDataPresenter>

In Visual Basic:

Imports Infragistics.Windows.DataPresenter
...
'xamDataCards
Me.xamDataCards1.ViewSettings.ShouldCollapseEmptyCells = True
'xamDataPresenter
Dim cardView1 As CardView = TryCast(Me.xamDataPresenter1.View, CardView)
If cardView1 IsNot Nothing Then
    cardView1.ViewSettings.ShouldCollapseEmptyCells = True
End If
...

In C#:

using Infragistics.Windows.DataPresenter;
...
//xamDataCards
this.xamDataCards1.ViewSettings.ShouldCollapseEmptyCells = true;
//xamDataPresenter
CardView cardView1 = this.xamDataPresenter1.View as CardView;
if(cardView1 != null)
{
    cardView1.ViewSettings.ShouldCollapseEmptyCells = true;
}
...