Siticone Data Grid View
The SiticoneDataGridView is an advanced wrapper around the standard Windows Forms DataGridView.
It simplifies complex styling with extensive Theming support, built-in Sample Data for rapid prototyping,
and enhanced design-time features via Smart Tags.
Themes & Appearance
Apply professional color schemes instantly using the GridTheme property.
| Property | Type | Description & Usage Example |
|---|---|---|
GridTheme |
GridTheme | grid.GridTheme = GridTheme.Dark; Selects a preset theme. Includes Standard (Light, Dark, Blue), Extended (Purple, Cyan, Olive), and Professional (Oceanic, Sunset) themes. |
HeaderFont |
Font | grid.HeaderFont = new Font("Segoe UI", 11, FontStyle.Bold); Customizes the typography for column headers. |
CellFont |
Font | grid.CellFont = new Font("Segoe UI", 9); Customizes the typography for data cells. |
ColumnHeaderHeight |
int | grid.ColumnHeaderHeight = 40; Sets the fixed height for the header row. |
RowHeight |
int | grid.RowHeight = 35; Sets the height for all data rows. |
Data Binding & Prototyping
Features to help you bind real data or visualize layouts before data is available.
| Property | Type | Description & Usage Example |
|---|---|---|
DataSource |
object | grid.DataSource = myListData; Bind Lists, DataTables, or BindingSources to populate the grid. |
ShowSampleData |
bool | grid.ShowSampleData = true; Design-Time Feature: Automatically populates the grid with dummy columns and rows to help you style the grid without running the app. |
Behavior & Interaction
Controls user interaction restrictions and layout logic.
| Property | Type | Description & Usage Example |
|---|---|---|
LockCellEditing |
bool | grid.LockCellEditing = true; Sets the grid to Read-Only mode, preventing direct user edits. |
AutoSizeColumnsMode |
Mode | grid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; Determines how columns resize (Fill, AllCells, etc.). |
SelectionMode |
Mode | grid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; Controls selection behavior (Row, Cell, Column). |
AllowUserToAddRows |
bool | grid.AllowUserToAddRows = false; |
RowHeadersVisible |
bool | grid.RowHeadersVisible = false; |
Advanced Access
Direct access to the underlying control for complex scenarios.
| Property | Type | Description |
|---|---|---|
GridView |
DataGridView |
Exposes the raw standard System.Windows.Forms.DataGridView control wrapped inside.
Use this to access events or properties not directly exposed by SiticoneDataGridView.
|
Smart Tags
The control includes extensive Smart Tag support in the Visual Studio Designer. Clicking the top-right arrow on the control allows you to quickly access smart tags.
GridTheme Enum
public enum GridTheme
{
// Standard
Light, Dark, Gray, Green, Blue, Red, Purple, Orange, Teal, Brown,
// Extended
Magenta, Cyan, Olive, Maroon, Navy, Lime, Indigo, Silver, Gold, Coral,
// Professional
Oceanic, Sunset, Forest, Midnight
}
Detailed Usage Examples
Example 1: Binding a List of Objects
Populating the grid with a standard generic list of custom objects.
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
}
private void LoadGrid()
{
var products = new List<Product>
{
new Product { Id = 1, Name = "Laptop", Price = 999.99m },
new Product { Id = 2, Name = "Mouse", Price = 24.50m },
new Product { Id = 3, Name = "Keyboard", Price = 49.99m }
};
siticoneDataGridView1.DataSource = products;
}
Example 2: Applying Themes Dynamically
Changing the visual style of the grid at runtime based on user preference.
private void btnDarkMode_Click(object sender, EventArgs e)
{
siticoneDataGridView1.GridTheme = GridTheme.Dark;
}
private void btnOceanicMode_Click(object sender, EventArgs e)
{
siticoneDataGridView1.GridTheme = GridTheme.Oceanic;
}
Example 3: Customizing Fonts & Layout
Manually overriding theme defaults for specific requirements.
private void CustomizeGrid()
{
// Use the Light theme as a base
siticoneDataGridView1.GridTheme = GridTheme.Light;
// Override fonts
siticoneDataGridView1.HeaderFont = new Font("Segoe UI", 12, FontStyle.Bold);
siticoneDataGridView1.CellFont = new Font("Consolas", 10);
// Adjust heights for touch friendliness
siticoneDataGridView1.ColumnHeaderHeight = 50;
siticoneDataGridView1.RowHeight = 45;
// Disable editing
siticoneDataGridView1.LockCellEditing = true;
}
Example 4: Accessing Underlying Grid Events
Using the GridView property to hook into specific DataGridView events like cell formatting.
public MainForm()
{
InitializeComponent();
// Hook into the underlying DataGridView CellFormatting event
siticoneDataGridView1.GridView.CellFormatting += GridView_CellFormatting;
}
private void GridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
// Format the "Price" column as currency
if (siticoneDataGridView1.GridView.Columns[e.ColumnIndex].Name == "Price")
{
if (e.Value != null)
{
e.Value = string.Format("{0:C}", e.Value);
e.FormattingApplied = true;
}
}
}