Infragistics(R) NetAdvantage(R) Windows Forms
Style Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > UltraGridCardSettings Class : Style Property

Returns or sets the style of the card.

Syntax

Visual Basic (Declaration) 
Public Property Style As CardStyle
C# 
public CardStyle Style {get; set;}

Example

Following code illustrates how to use Card View feature in the UltraGrid. Following code turns on the card-view for the first band. All the descendants of that band will automatically get hidden.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Button18_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button18.Click

      ' Following code illustrates how to use Card View feature in the UltraGrid.
      ' Following code turns on the card-view for the first band. All the 
      ' descendants of that band will automatically get hidden.

      ' Get the band that you want in card-view.
      Dim band As UltraGridBand = Me.UltraGrid1.DisplayLayout.Bands(0)

      ' Turn the card-view on for that band. All the descendants of that band 
      ' will automatically get hidden.
      band.CardView = True

      ' Optinally set the style to desired card-view style.
      band.CardSettings.Style = CardStyle.MergedLabels

      ' If desired, further customize the card-view's visual and behavioural aspects.

      ' Set the CaptionField to the key of the column value of which you want 
      ' displayed on captions of rows.
      band.CardSettings.CaptionField = "CustomerID"

      ' Whether to show the caption for each row or not.
      band.CardSettings.ShowCaption = True

      ' Set the LabelWidth to control the width of the label area which is the area
      ' where all the column headers are displayed.
      band.CardSettings.LabelWidth = 120

      ' Whether the user can resize width of the label area.
      band.CardSettings.AllowLabelSizing = False

      ' Set the Width to control the width of the cell area which is the area where 
      ' where all the cells are displayed.
      band.CardSettings.Width = 140

      ' Whether the user is allowed to resize the width of the cell area.
      band.CardSettings.AllowSizing = True

      ' Should card auto-fit, that is occupy the all of the available horizontal space.
      band.CardSettings.AutoFit = False

      ' Number of lines of the card captions. This controls the height of the card 
      ' captions.
      band.CardSettings.CaptionLines = 1

      ' A card row visually contains a whole collection of rows. It typically lays out cards
      ' in a grid-like fashion. By default it tries to fit as may cards as possible within
      ' available width and height. MaxCardAreaCols and MaxCardAreaRows dictate the max number of
      ' columns and rows a card row will display.
      band.CardSettings.MaxCardAreaCols = 4
      band.CardSettings.MaxCardAreaRows = 1

      ' Set the spacing bettween cards in pixel.
      band.Override.CardSpacing = 20

      ' Set various appearance related properties.
      band.Override.BorderStyleCardArea = UIElementBorderStyle.Raised

      ' CardAreaAppearance applies to the whole card area.
      band.Override.CardAreaAppearance.BackColor = Color.LightGray

      ' SelectedCardCaptionAppearance appearance applies to the card captions of selected 
      ' cards in card-view.
      band.Override.SelectedCardCaptionAppearance.BackColor = Color.Green
      band.Override.SelectedCardCaptionAppearance.ForeColor = Color.White

      ' ActiveCardCaptionAppearance appearance applies to the card caption of the active
      ' card in card-view. 
      band.Override.ActiveCardCaptionAppearance.BackColor = Color.Red
      band.Override.ActiveCardCaptionAppearance.ForeColor = Color.LightYellow

      ' Also various appearance and border related properties used for setting up objects like
      ' cells, rows, headers in non-card view also apply in card-view. 

      ' BorderStyleRow sets the border style of cards.
      band.Override.BorderStyleRow = UIElementBorderStyle.Raised

      ' BorderStyleCell applies to cells in the cards.
      band.Override.BorderStyleCell = UIElementBorderStyle.Inset

      ' BorderStyleHeader applies to column captions in the card.
      band.Override.BorderStyleHeader = UIElementBorderStyle.Raised

      ' CellAppearance applies to cells in the cards.
      band.Override.CellAppearance.BackColor = Color.LightYellow

      ' HeaderAppearance applies to column captions in the card.
      band.Override.HeaderAppearance.FontData.Bold = DefaultableBoolean.True

  End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void button18_Click(object sender, System.EventArgs e)
{

	// Following code illustrates how to use Card View feature in the UltraGrid.
	// Following code turns on the card-view for the first band. All the 
	// descendants of that band will automatically get hidden.

	// Get the band that you want in card-view.
	UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0];

	// Turn the card-view on for that band. All the descendants of that band 
	// will automatically get hidden.
	band.CardView = true;
          
	// Optinally set the style to desired card-view style.
	band.CardSettings.Style = CardStyle.MergedLabels;

	// If desired, further customize the card-view's visual and behavioural aspects.

	// Set the CaptionField to the key of the column value of which you want 
	// displayed on captions of rows.
	band.CardSettings.CaptionField = "CustomerID";

	// Whether to show the caption for each row or not.
	band.CardSettings.ShowCaption = true;			

	// Set the LabelWidth to control the width of the label area which is the area
	// where all the column headers are displayed.
	band.CardSettings.LabelWidth = 120;
	
	// Whether the user can resize width of the label area.
	band.CardSettings.AllowLabelSizing = false;

	// Set the Width to control the width of the cell area which is the area where 
	// where all the cells are displayed.
	band.CardSettings.Width = 140;
	
	// Whether the user is allowed to resize the width of the cell area.
	band.CardSettings.AllowSizing = true;

	// Should card auto-fit, that is occupy the all of the available horizontal space.
	band.CardSettings.AutoFit = false;

	// Number of lines of the card captions. This controls the height of the card 
	// captions.
	band.CardSettings.CaptionLines = 1;

	// A card row visually contains a whole collection of rows. It typically lays out cards
	// in a grid-like fashion. By default it tries to fit as may cards as possible within
	// available width and height. MaxCardAreaCols and MaxCardAreaRows dictate the max number of
	// columns and rows a card row will display.
	band.CardSettings.MaxCardAreaCols = 4;
	band.CardSettings.MaxCardAreaRows = 1;

	// Set the spacing bettween cards in pixel.
	band.Override.CardSpacing = 20;

	// Set various appearance related properties.
	band.Override.BorderStyleCardArea = UIElementBorderStyle.Raised;

	// CardAreaAppearance applies to the whole card area.
	band.Override.CardAreaAppearance.BackColor = Color.LightGray;

	// SelectedCardCaptionAppearance appearance applies to the card captions of selected 
	// cards in card-view.
	band.Override.SelectedCardCaptionAppearance.BackColor = Color.Green;
	band.Override.SelectedCardCaptionAppearance.ForeColor = Color.White;

	// ActiveCardCaptionAppearance appearance applies to the card caption of the active
	// card in card-view. 
	band.Override.ActiveCardCaptionAppearance.BackColor = Color.Red;
	band.Override.ActiveCardCaptionAppearance.ForeColor = Color.LightYellow;

	// Also various appearance and border related properties used for setting up objects like
	// cells, rows, headers in non-card view also apply in card-view. 
	
	// BorderStyleRow sets the border style of cards.
	band.Override.BorderStyleRow = UIElementBorderStyle.Raised;

	// BorderStyleCell applies to cells in the cards.
	band.Override.BorderStyleCell = UIElementBorderStyle.Inset;

	// BorderStyleHeader applies to column captions in the card.
	band.Override.BorderStyleHeader = UIElementBorderStyle.Raised;

	// CellAppearance applies to cells in the cards.
	band.Override.CellAppearance.BackColor = Color.LightYellow;

	// HeaderAppearance applies to column captions in the card.
	band.Override.HeaderAppearance.FontData.Bold = DefaultableBoolean.True;

}

Remarks

When you place a band in card view mode, the data from each row from that band is displayed as a card. These cards are arranged in a rectangular card view area, which replaces the row in the visible grid. The column headers of the band become the labels for the cards. The cards are arranged in "stacks" or columns of cards, with each stack consisting of one or more "layers" or rows of individual cards. The Style property specifies how the cards will be arranged within the card view area.

There are three styles of card display. Standard Labels style displays the data labels on each card. Cards are arranged into columns (or "stacks") each having an identical number of rows of cards (or "levels") and each card is the the same height. In Merged Labels style, there is one area for labels on the left side of the card area and the cards themselves contain only the data. Merged Labels style also displays symmetrical stacks of cards with a fixed number of levels that share a common height.

When using the Variable Height style, labels are displayed on each card, but the height of the individual cards changes based on the contents of the card. If a data field has an empty value (a data value of DBNULL or an empty string for string fields) that field does not appear on the card. Note that when using Variable Height style there is no way to add values to empty fields, since empty fields are inaccessible.

Each stack of cards in the Variable Height view style may contain a different number of levels, and the levels may not line up into neat rows and columns as they do with the other styles. Because the number of levels per stack is variable, there is a difference in the way certain properties are applied in this mode. For example, the MaxCardAreaRows property determines the maximum number of levels that will be displayed based on the height of a theoretical stack made up of cards with all their fields visible, rather than on the height of any actual stack that is being displayed.

See Also