Siticone Logo
Siticone UI
DOCS
v2025.12.15
Docs DataTable

Siticone Data Table

The SiticoneDataTable is a modern, high-performance alternative to the standard Windows Forms DataGridView. It provides a sleek, flat user interface with built-in support for pagination, sorting, status pills, and advanced styling customization. Designed for modern applications, it handles large datasets efficiently while offering a polished user experience out of the box.

Core Data Binding

Properties for connecting your data and managing how it is displayed.

Property Type Description & Usage Example
DataSource object table.DataSource = myDataTable; The primary data source. Accepts DataTable, DataSet, or List objects. Setting this automatically generates columns and populates rows.
ShowSampleData bool table.ShowSampleData = true; Displays dummy data in the designer to help visualize layout and styling without running the application.
NoDataMessage string table.NoDataMessage = "No records found"; The text displayed in the center of the control when the data source is empty.

Pagination & Navigation

Built-in controls for managing large datasets across multiple pages.

Property Type Description
ShowPagination bool Toggles the visibility of the footer containing page navigation buttons and row count selector.
PageSize int Defines how many rows are displayed per page. Default is 10. Set to -1 to show all rows.
CurrentPage int Gets or sets the active page number (1-based index).
PaginationHeight int The height of the bottom pagination area in pixels.

Appearance & Styling

Extensive customization options for colors, fonts, and layout.

Property Type Description
DarkMode bool Switches the entire table between Light and Dark visual themes.
CornerRadius int Rounds the corners of the table container.
ShowBorder bool Toggles the outer border of the control.
HeaderHeight int The height of the column header row.
RowHeight int The height of each data row.
ShowRowLines bool Displays horizontal separator lines between rows.
EnableRowHoverHighlight bool Highlights the row under the mouse cursor for better readability.

Selection & Checkboxes

Features for selecting and interacting with data rows.

Property Type Description
ShowCheckboxColumn bool Adds a dedicated column with checkboxes for multi-row selection.
ShowSelectAllCheckbox bool Shows a "Select All" checkbox in the header row.
EnableRowSelectionAnimation bool Animate the selection indicator on the left side of rows.

Useful Public Functions (API)

Essential methods for programmatic interaction with the table.

GetSelectedRows()
// Returns a list of DataRow objects for all currently checked rows.
var selected = siticoneDataTable1.GetSelectedRows();
foreach (DataRow row in selected)
{
                Console.WriteLine(row["ID"]);
}
DeleteSelectedRows()
// Deletes all checked rows from the underlying DataTable.
// Automatically shows a confirmation dialog to the user before deleting.
int count = siticoneDataTable1.DeleteSelectedRows();
Refresh()
// Forces the table to reload data from the DataSource and redraw.
// Useful if the underlying list/table has changed externally.
siticoneDataTable1.Refresh();

// Overload: Refresh preserving selection
siticoneDataTable1.Refresh(preserveSelection: true);
SelectRow(int rowIndex)
// Programmatically selects a specific row by its index.
siticoneDataTable1.SelectRow(5);
SetStatusColor()
// Customizes the colors for "Pill" status columns.
// Arguments: Status Text, Background Color, Foreground Color, IsDarkMode
siticoneDataTable1.SetStatusColor("Overdue", Color.MistyRose, Color.Red, false);

Handling Events

Key events for responding to user interactions.

RowSelected
// Fires when a user checks or unchecks a row's checkbox.
siticoneDataTable1.RowSelected += (sender, e) => 
{
                Console.WriteLine($"Row {e.RowIndex} selection changed.");
};
RowDoubleClicked
// Fires when a row is double-clicked. 
// 'e' provides access to the clicked row's data.
private void siticoneDataTable1_RowDoubleClicked(object sender, RowEventArgs e)
{    
                var id = e.GetCellValue<int>("ID");
                MessageBox.Show($"Opening details for ID: {id}");
}
RowRightClick
// Fires when a row is right-clicked. Perfect for context menus.
siticoneDataTable1.RowRightClick += (sender, e) => 
{
    contextMenuStrip1.Show(Cursor.Position);
};

Detailed Usage Examples

Example 1: Generating Sample Data

This example demonstrates how to create a DataTable, populate it with dummy data (including a status column for pill styling), and bind it to the control.

C# - Load Sample Data
using System.Data; // Required for DataTable
using System.Drawing; // Required for Colors

public void Load30SampleRows()
{
                // 1. Create a standard DataTable
                DataTable dt = new DataTable();

                // 2. Define the columns
    dt.Columns.Add("ID", typeof(int));
    dt.Columns.Add("Invoice", typeof(string));
    dt.Columns.Add("Date", typeof(DateTime));
    dt.Columns.Add("Amount", typeof(decimal));
    dt.Columns.Add("Status", typeof(string));

                // 3. Generate 30 rows loop
                Random rand = new Random();
                for (int i = 1; i <= 30; i++)
    {
                // Create status logic for variety (Paid, Pending, Failed)
                string status = (i % 3 == 0) ? "Failed" : ((i % 2 == 0) ? "Pending" : "Paid");
        
        dt.Rows.Add(
            i, 
                $"INV-{rand.Next(1000, 9999)}", 
                DateTime.Now.AddDays(-i), 
            (decimal)rand.NextDouble() * 500, 
            status
        );
    }

                // 4. Assign to the SiticoneDataTable Control
                // Note: This triggers the UpdateDataTableFromDataSource method internally
    siticoneDataTable1.DataSource = dt;

                // 5. (Optional) Enable features like Pagination and Styling
                // The control defaults to PageSize = 10, so 30 rows will create 3 pages automatically.
    siticoneDataTable1.PageSize = 10; 
    siticoneDataTable1.ShowPagination = true; 

                // 6. (Optional) Restore the "Status Pill" styling
                // When you set a DataSource, columns are reset. You must manually re-enable 
                // special column types like Status or Icons if you want them.
                // Index 0 is the Checkbox, so "Status" (added 5th above) is at index 5.
                if (siticoneDataTable1.Columns.Count > 5)
    {
        siticoneDataTable1.Columns[5].IsStatusColumn = true; 
        siticoneDataTable1.Columns[5].TextAlignment = StringAlignment.Center;
    }
}

Example 2: Applying a Theme Programmatically

You can switch between predefined themes at runtime. This example applies the Modern Blue theme in Light Mode.

C# - Apply Theme
// Apply a modern blue look
// pass 'true' for Dark Mode, 'false' for Light Mode
siticoneDataTable1.ApplyModernBlueTheme(false);

Advanced Examples & Scenarios

These scenarios cover powerful features like bulk editing, data export, and undo operations.

Scenario 1: Bulk Edit Selected Rows

Modify multiple rows at once. This function applies updates to all checked rows and refreshes the table instantly.

C# - Bulk Edit
private void BtnMarkPaid_Click(object sender, EventArgs e)
{
                // Create a dictionary of column names and their new values
                var updates = new Dictionary<string, object>
    {
        { "Status", "Paid" },
        { "LastUpdated", DateTime.Now }
    };

                // Apply changes to all selected rows
                // confirmChanges: true will show a popup asking user to verify
                int count = siticoneDataTable1.BulkEditSelectedRows(updates, confirmChanges: true);
    
                MessageBox.Show($"Successfully updated {count} rows.");
}

Scenario 2: Export Selection to CSV

Generate a CSV string from the currently selected rows, perfect for clipboard copying or file saving.

C# - CSV Export
private void BtnCopyCSV_Click(object sender, EventArgs e)
{
                // Get CSV string (includeHeaders: true)
                string csvData = siticoneDataTable1.ExportSelectedRowsToCSV(true);
    
                if (!string.IsNullOrEmpty(csvData))
    {
                Clipboard.SetText(csvData);
                MessageBox.Show("Copied to clipboard!");
    }
}

Scenario 3: Undo Last Deletion

The control tracks deletions internally. You can restore accidental deletions using the built-in undo capability.

C# - Undo Delete
private void BtnDelete_Click(object sender, EventArgs e)
{
                // 1. Perform deletion and store the result for potential undo
    siticoneDataTable1.DeleteSelectedRowsWithUndo();
    
                // Show undo button
    btnUndo.Visible = true;
}

private void BtnUndo_Click(object sender, EventArgs e)
{
                // 2. Check if undo is possible
                if (siticoneDataTable1.CanUndo())
    {
                var result = siticoneDataTable1.UndoDeletion();
                MessageBox.Show(result.Message);
        btnUndo.Visible = false;
    }
}

Scenario 4: Custom Pagination Logic

Control the page navigation programmatically, useful for building custom toolbars or keyboard shortcuts.

C# - Custom Pagination
private void GoToNextPage()
{
                int current = siticoneDataTable1.CurrentPage;
                int total = siticoneDataTable1.TotalPages;

                if (current < total)
    {
        siticoneDataTable1.CurrentPage = current + 1;
    }
}

private void ChangePageSize(int newSize)
{
                // Set new size (e.g., 50 rows per page)
    siticoneDataTable1.PageSize = newSize;
    
                // Reset to page 1 to avoid out-of-bounds issues
    siticoneDataTable1.CurrentPage = 1;
}

Designer Support

The control provides a robust Smart Tag panel in Visual Studio, designed for rapid configuration without writing code.

🎨
Theme Presets
Instantly apply professional color schemes like Modern Blue, Green, or Corporate with a single click from the Smart Tag menu.
Quick Settings
Toggle Dark Mode or populate the table with Sample Data instantly to visualize your layout during design time.
📐
Appearance Tuning
Visually adjust Corner Radius, Border Visibility, and Header Height directly from the property grid.
📋
Copy & Paste
Copy styling from one table and paste it onto another to maintain consistency across your application forms.