You can add and remove Splits at design time and through code. Besides, you can also set many split-specific properties and control the visibility of columns for specific splits through code or designer. For more information about the designer, see Split Collection Editor.
Let us now explore how to perform some basic operations on Splits in the List control.
The C1List class provides InsertHorizontalSplit and InsertVerticalSplit methods to insert horizontal and vertical splits, respectively. These methods take the index of the split as their parameter and create a split at the specified position.
The following code demonstrates how to create horizontal and vertical splits in the List control.
C# |
Copy Code
|
---|---|
//create a horizontal split c1List1.InsertHorizontalSplit(1); //create vertical split c1List1.InsertVerticalSplit(1); |
To delete a particular split from the list, you can use RemoveHorizontalSplit or RemoveVerticalSplit method of the C1List class. The RemoveHorizontalSplit method takes the index of the horizontal split as its parameter and deletes the specified split. Similarly, the RemoveVerticalSplit method deletes the specified vertical split.
The following code shows how splits can be deleted from the List control.
C# |
Copy Code
|
---|---|
//remove horizontal split c1List1.RemoveHorizontalSplit(1); //remove vertical split c1List1.RemoveVerticalSplit(1); |
List allows you to set the caption for specific splits by using Caption property of the Split class. It also lets you set the height of the caption by using CaptionHeight property of the Split class as shown in the following code.
C# |
Copy Code
|
---|---|
//set caption c1List1.Splits[0].Caption = "Split 1"; //set caption height c1List1.Splits[0].CaptionHeight = 10; |
By default, all the column fields are visible in the splits. However, you can choose to hide any individual column in a specific split. To do so, you can set Visible property of the C1DisplayColumn class to false as shown in the following code.
C# |
Copy Code
|
---|---|
this.c1List1.Splits[0].DisplayColumns["Last Name"].Visible = false; |
Besides, you can also use the C1DisplayColumn Collection Editor to set the visibility of columns in splits. For more information, see C1DisplayColumn Collection Editor.