This example demonstrates how to add a check button to the Find Panel. For this, it is necessary to call the AddCheckButton method for the FindPanelItems collection.
Files to Review
- Form1.cs (VB: Form1.vb)
- Program.cs (VB: Program.vb)
See Also
Does this example address your development requirements/objectives?
(you will be redirected to DevExpress.com to submit your response)
Example Code
C#using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Controls;
namespace MyXtraGrid {
public partial class Form1 : Form {
private DataTable CreateTable(int RowCount)
{
DataTable tbl = new DataTable();
tbl.Columns.Add("Name", typeof(string));
tbl.Columns.Add("ID", typeof(int));
tbl.Columns.Add("Number", typeof(int));
tbl.Columns.Add("Date", typeof(DateTime));
for (int i = 0; i < RowCount; i++)
tbl.Rows.Add(new object[] { String.Format("Name{0}", i), i, 3 - i, DateTime.Now.AddDays(i) });
return tbl;
}
public Form1() {
InitializeComponent();
myGridControl1.DataSource = CreateTable(20);
CheckButton showCustomButton = myGridView1.FindPanelItems.AddCheckButton("test", true);
showCustomButton.ImageOptions.ImageUri.Uri = "Filter;Size16x16;Svg";
showCustomButton.CheckedChanged += ShowCustomButton_CheckedChanged;
}
private void ShowCustomButton_CheckedChanged(object sender, EventArgs e)
{
MessageBox.Show("CheckButton is clicked");
}
}
}
C#using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace MyXtraGrid {
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}