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

Specifies if and how headers are displayed.

Syntax

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

Example

Following code shows various properties available to control visibility of band, group and column headers.

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

  Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
      ' Get the band to hide the headers in.
      Dim band As UltraGridBand = Me.ultraGrid1.DisplayLayout.Bands(0)

      ' You can hide the column headers by setting ColHeadersVisible to false. By
      ' default, column headers are visible.
      band.ColHeadersVisible = False

      ' You can hide the group headers by setting GroupHeadersVisible to false. By
      ' default, group headers are visible.
      band.GroupHeadersVisible = False

      ' You can also show the band header which by default is hidden by setting 
      ' the HeaderVisible property to true.
      band.HeaderVisible = True

      ' You can also set the caption of the band header.
      band.Header.Caption = "Customers Table"

      ' You can also set the apperance of the band header using Appearance property 
      ' off the header.
      band.Header.Appearance.BackColor = Color.DarkBlue
      band.Header.Appearance.ForeColor = Color.LightYellow

      ' You can use the HeaderPlacement property to specify how headers are displayed.
      band.Override.HeaderPlacement = HeaderPlacement.FixedOnTop

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

private void button1_Click(object sender, System.EventArgs e)
{
	// Get the band to hide the headers in.
	UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0];

	// You can hide the column headers by setting ColHeadersVisible to false. By
	// default, column headers are visible.
	band.ColHeadersVisible = false;

	// You can hide the group headers by setting GroupHeadersVisible to false. By
	// default, group headers are visible.
	band.GroupHeadersVisible = false;

	// You can also show the band header which by default is hidden by setting 
	// the HeaderVisible property to true.
	band.HeaderVisible = true;

	// You can also set the caption of the band header.
	band.Header.Caption = "Customers Table";

	// You can also set the apperance of the band header using Appearance property 
	// off the header.
	band.Header.Appearance.BackColor = Color.DarkBlue;
	band.Header.Appearance.ForeColor = Color.LightYellow;

	// You can use the HeaderPlacement property to specify how headers are displayed.
	band.Override.HeaderPlacement = HeaderPlacement.FixedOnTop;
}

Remarks

By default the UltraGrid repeats headers whenever there is a break in the band. In other words a visible row displays column headers if the previous visible row is from a different band. For example in a multi band hiearchy if you expand a row, it's sibling row from the same band also displays headers. This repeating of headers can lead to waste of screen space. This feature lets you specify different header placement styles that minimize and even eliminate repeating of the column headers.

Note that this property has no effect when the UltraGridLayout.ViewStyle is set to SingleBand or when UltraGridLayout.ViewStyleBand is set to Horizontal. Due to the nature of these view styles the headers are always non-repeating (fixed on top), and therefore this property has no effect when these view styles are in effect. By default these view styles are not in effect.

Also note that header placement will take effect when printing however it will not have any effect when exporting to excel.

See Also