Xceed Grid for WinForms v4.3 Documentation
VisibleIndex Property
Example 


Xceed.Grid.v4.3 Assembly > Xceed.Grid Namespace > Column Class : VisibleIndex Property
Gets or sets the visible position of the column.
Syntax
'Declaration
 
<DescriptionAttribute("The visible position of the column.")>
<CategoryAttribute("Appearance")>
<MergablePropertyAttribute(False)>
<LocalizableAttribute(True)>
<ApplyToDesignerAttribute(True)>
Public Property VisibleIndex As Integer
'Usage
 
Dim instance As Column
Dim value As Integer
 
instance.VisibleIndex = value
 
value = instance.VisibleIndex
[Description("The visible position of the column.")]
[Category("Appearance")]
[MergableProperty(false)]
[Localizable(true)]
[ApplyToDesigner(true)]
public int VisibleIndex {get; set;}

Property Value

A zero-based value indicating the visible position of the column.
Remarks

The visible position of the column does not necessarily correspond to its position in the data source.

The value used to change the visual positions of the columns can be higher than the number of columns. For example, if a grid contains 4 columns and the visual position of the first column is changed to 42, its new visible position, once the visible positions of the columns has been resequenced would be 3 (the 4th visible column).

If the visible indexes of the columns are changed between calls to GridControl.BeginInit and GridControl.EndInit, the visible positions of the columns will only be resequenced once EndInit is called. The physical Index of the column will determine its visible position if 2 or more columns end up with the same visual index.

Example
The following example demonstrates what happens when the visible position of a column changes: The next example, demonstrates what happens when we increment the visible position of a column: The following example demonstrates what happens when we change the visible position of a column but with the code between GridControl.BeginInit and GridControl.EndInit method calls.
' Let's assume that the following columns start in the following 
' visible positions

gridControl1.Columns( 0 ).VisibleIndex = 0
gridControl1.Columns( 1 ).VisibleIndex = 1
gridControl1.Columns( 2 ).VisibleIndex = 2
gridControl1.Columns( 3 ).VisibleIndex = 3

' Set the visible position of the 4th column to 1 
' to make it the second column in the grid.

gridControl1.Columns( 3 ).VisibleIndex = 1

' As a result, the columns would then possess
' the following visible positions

gridControl1.Columns( 0 ).VisibleIndex = 0
gridControl1.Columns( 1 ).VisibleIndex = 2
gridControl1.Columns( 2 ).VisibleIndex = 3
gridControl1.Columns( 3 ).VisibleIndex = 1
// Let's assume that the following columns start in the following 
// visible positions

gridControl1.Columns[ 0 ].VisibleIndex = 0;
gridControl1.Columns[ 1 ].VisibleIndex = 1;
gridControl1.Columns[ 2 ].VisibleIndex = 2;
gridControl1.Columns[ 3 ].VisibleIndex = 3;

// Set the visible position of the 4th column to 1
// to make it the second column in the grid

gridControl1.Columns[ 3 ].VisibleIndex = 1;

// As a result, the columns would then possess
// the following visible positions

gridControl1.Columns[ 0 ].VisibleIndex = 0;
gridControl1.Columns[ 1 ].VisibleIndex = 2;
gridControl1.Columns[ 2 ].VisibleIndex = 3;
gridControl1.Columns[ 3 ].VisibleIndex = 1;
' Let's assume that the following columns start in the following 
' visible positions

gridControl1.Columns( 0 ).VisibleIndex = 0
gridControl1.Columns( 1 ).VisibleIndex = 1
gridControl1.Columns( 2 ).VisibleIndex = 2
gridControl1.Columns( 3 ).VisibleIndex = 3

' Set the visible position of the 1st column to 2 
' to make it the third column in the grid

gridControl1.Columns( 0 ).VisibleIndex = 2

' As a result, the columns would then possess
' the following visible positions

gridControl1.Columns( 0 ).VisibleIndex = 2
gridControl1.Columns( 1 ).VisibleIndex = 0
gridControl1.Columns( 2 ).VisibleIndex = 1
gridControl1.Columns( 3 ).VisibleIndex = 3
// Let's assume that the following columns start in the following 
// visible positions

gridControl1.Columns[ 0 ].VisibleIndex = 0;
gridControl1.Columns[ 1 ].VisibleIndex = 1;
gridControl1.Columns[ 2 ].VisibleIndex = 2;
gridControl1.Columns[ 3 ].VisibleIndex = 3;

// Set the visible position of the 1st column to 2 
// to make it the third column in the grid

gridControl1.Columns[ 0 ].VisibleIndex = 2;

// As a result, the columns would then possess
// the following visible positions

gridControl1.Columns[ 0 ].VisibleIndex = 2;
gridControl1.Columns[ 1 ].VisibleIndex = 0;
gridControl1.Columns[ 2 ].VisibleIndex = 1;
gridControl1.Columns[ 3 ].VisibleIndex = 3;
' Let's assume that the following columns start in the following 
' visible positions

gridControl1.Columns( 0 ).VisibleIndex = 0
gridControl1.Columns( 1 ).VisibleIndex = 1
gridControl1.Columns( 2 ).VisibleIndex = 2
gridControl1.Columns( 3 ).VisibleIndex = 3

' Set the visible position of the 1st and
' second columns between calls to the BeginInit
' and EndInit methods

gridControl1.BeginInit()
   gridControl1.Columns( 0 ).VisibleIndex = 2
   gridControl1.Columns( 1 ).VisibleIndex = 3

   ' At this point, the columns have the following visible indexes:
   ' Column( 0 ) -&gt; 2
   ' Column( 1 ) -&gt; 3
   ' Column( 2 ) -&gt; 2
   ' Column( 3 ) -&gt; 3
   
   ' Since the first and third columns, as well as the second and fourth columns,
   ' have the same visible indexes, the physical index of the columns with the same
   ' visible index will determine which column is displayed first.
gridControl1.EndInit()

' As a result, the columns would then possess
' the following visible positions. 

gridControl1.Columns( 0 ).VisibleIndex = 0
gridControl1.Columns( 1 ).VisibleIndex = 2
gridControl1.Columns( 2 ).VisibleIndex = 1
gridControl1.Columns( 3 ).VisibleIndex = 3

' If the visible positions of the columns would
' have been changed outside of calls to BeginInit and
' EndInit, the result would have been:

gridControl1.Columns( 0 ).VisibleIndex = 2
gridControl1.Columns( 1 ).VisibleIndex = 0
gridControl1.Columns( 2 ).VisibleIndex = 3
gridControl1.Columns( 3 ).VisibleIndex = 1
// Let's assume that the following columns start in the following 
// visible positions

gridControl1.Columns[ 0 ].VisibleIndex = 0;
gridControl1.Columns[ 1 ].VisibleIndex = 1;
gridControl1.Columns[ 2 ].VisibleIndex = 2;
gridControl1.Columns[ 3 ].VisibleIndex = 3;

// Set the visible position of the 1st and
// second columns between calls to the BeginInit
// and EndInit methods

gridControl1.BeginInit();
   gridControl1.Columns[ 0 ].VisibleIndex = 2;
   gridControl1.Columns[ 1 ].VisibleIndex = 3;
   
   // At this point, the columns have the following visible indexes:
   // Column( 0 ) -&gt; 2
   // Column( 1 ) -&gt; 3
   // Column( 2 ) -&gt; 2
   // Column( 3 ) -&gt; 3
   
   // Since the first and third columns, as well as the second and fourth columns,
   // have the same visible indexes, the physical index of the columns with the same
   // visible index will determine which column is displayed first.
gridControl1.EndInit();

// As a result, the columns would then possess
// the following visible positions

gridControl1.Columns[ 0 ].VisibleIndex = 0;
gridControl1.Columns[ 1 ].VisibleIndex = 2;
gridControl1.Columns[ 2 ].VisibleIndex = 1;
gridControl1.Columns[ 3 ].VisibleIndex = 3;

// If the visible positions of the columns would
// have been changed outside of calls to BeginInit and
// EndInit, the result would have been:

gridControl1.Columns[ 0 ].VisibleIndex = 2;
gridControl1.Columns[ 1 ].VisibleIndex = 0;
gridControl1.Columns[ 2 ].VisibleIndex = 3;
gridControl1.Columns[ 3 ].VisibleIndex = 1;
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Column Class
Column Members