The xamDataCards™ control allows your end users to collapse (hide) empty cells in a card. You can enable this feature using one of the following techniques:
You can set the CardViewSettings object’s ShouldCollapseEmptyCells property to True to collapse empty cells in all cards.
You can set a Record object’s ShouldCollapseEmptyCells property to True to hide empty cells in a specific card.
You can execute the ToggleEmptyCardCellsCollapsedState command exposed by the DataPresenterCommands class. The command requires a Record object as a parameter. This will toggle the visibility of empty cells in a specific card.
You can set the CardViewSettings object’s CollapseEmptyCellsButtonVisibility property to Visible to display a button in the header of each card. Your end users can click the button to toggle the visibility of empty cells in a specific card.
You can also prevent your end users from collapsing cells in a field by setting the FieldSettings object’s CollapseWhenEmpty property to False.
The following example code demonstrates how to collapse a card. The Button control’s CommandParameter property is bound to the xamDataCards control’s ActiveRecord property.
In XAML:
<Button Content="Collapse or Expand Empty Cells in the Active Card" Command="{x:Static igDP:DataPresenterCommands.ToggleEmptyCardCellsCollapsedState}" CommandParameter="{Binding ElementName=xamDataCards1, Path=ActiveRecord}" CommandTarget="{Binding ElementName=xamDataCards1}" /> <igDP:XamDataCards Name="xamDataCards1" BindToSampleData="True"> <igDP:XamDataCards.ViewSettings> <igDP:CardViewSettings CollapseEmptyCellsButtonVisibility="Visible" ShouldCollapseEmptyCells="True" /> </igDP:XamDataCards.ViewSettings> </igDP:XamDataCards>
In Visual Basic:
Me.xamDataCards1.ViewSettings.CollapseEmptyCellsButtonVisibility = Visibility.Visible Me.xamDataCards1.ViewSettings.ShouldCollapseEmptyCells = True
In C#:
this.xamDataCards1.ViewSettings.CollapseEmptyCellsButtonVisibility = Visibility.Visible; this.xamDataCards1.ViewSettings.ShouldCollapseEmptyCells = true;