Siticone Data Grid
The SiticoneDataGrid is a powerful, "batteries-included" wrapper around the standard DataGridView.
It comes pre-packaged with a modern UI including a Ribbon Toolbar, Search functionality,
Export/Import capabilities (CSV, Excel, Encrypted), and a robust Theming System that can auto-detect the OS theme.
Theming & Appearance
Control the visual style with 20+ presets or automatic system theme detection.
| Property | Type | Description & Usage Example |
|---|---|---|
GridTheme |
DataGridTheme | grid.GridTheme = DataGridTheme.Dark; Selects a preset theme. Options include: Light, Dark, Gray, Green, Blue, Red, Purple, Orange, Teal, Brown, Magenta, Cyan, Olive, Maroon, Navy, Lime, Indigo, Silver, Gold, Coral. |
AutoDetectTheme |
bool | grid.AutoDetectTheme = true; When true, the control listens for Windows System Theme changes (Light/Dark mode) and updates automatically. |
ShowSampleData |
bool | grid.ShowSampleData = true; Populates the grid with dummy data for design-time visualization. |
RowHeight |
int | grid.RowHeight = 45; |
ColumnHeaderHeight |
int | grid.ColumnHeaderHeight = 40; |
Data Handling
Binding data sources and managing content visibility.
| Property | Type | Description & Usage Example |
|---|---|---|
DataSource |
object | grid.DataSource = myDataTable; The data source to display. Supports Lists, DataTables, BindingSources, etc. |
LockReatimeEditing |
bool | grid.LockReatimeEditing = true; If true, disables direct cell editing and row addition/deletion by the user. |
ReadOnly |
bool | grid.ReadOnly = true; |
Built-in Tools
The control includes an integrated toolbar offering:
- Search: Real-time filtering with debounce logic.
- Export: Save data to CSV, Excel (.xlsx), or Image (PNG/JPG). Supports Password Encryption.
- Import: Load data from CSV, Excel, or Encrypted files.
- Styling: Quick buttons for Bold, Italic, Underline, Text Color, Cell Color, and Text Alignment.
Events
Hooks for interacting with user actions.
| Event | Description |
|---|---|
DataSourceChanged |
Fired when the DataSource property is updated. |
ThemeChanged |
Fired when the visual theme is updated (manually or via auto-detection). |
RowDoubleClicked |
Fired when a user double-clicks a cell or row header. Useful for opening detail views. |
Detailed Usage Examples
Example 1: Basic Binding
Loading a simple list of objects into the grid.
public class Employee
{
public int Id { get; set; }
public string Name { get; set; }
public string Department { get; set; }
}
private void LoadData()
{
var employees = new List<Employee>
{
new Employee { Id = 1, Name = "Alice", Department = "HR" },
new Employee { Id = 2, Name = "Bob", Department = "IT" }
};
siticoneDataGrid1.DataSource = employees;
}
Example 2: Customizing Appearance
Applying a specific theme and overriding individual colors.
private void StyleGrid()
{
// Use a preset
siticoneDataGrid1.GridTheme = DataGridTheme.Coral;
// Customize specific elements
siticoneDataGrid1.RowHeight = 50;
siticoneDataGrid1.ColumnHeaderHeight = 45;
siticoneDataGrid1.HeaderFont = new Font("Segoe UI", 12, FontStyle.Bold);
// Override alternating row color manually if needed
siticoneDataGrid1.RowAlternatingBackColor = Color.MistyRose;
}
Example 3: Handling Row Interactions
Opening a details form when a row is double-clicked.
private void siticoneDataGrid1_RowDoubleClicked(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex < 0) return; // Ignore header clicks
// Access the underlying DataGridView
var grid = siticoneDataGrid1.GridView;
var row = grid.Rows[e.RowIndex];
// Retrieve data (assuming bound to Employee object)
var employee = row.DataBoundItem as Employee;
if (employee != null)
{
MessageBox.Show($"Editing Employee: {employee.Name}");
// Open edit form...
}
}