SearchControl에 값을 입력하여 CheckedListBoxControl 항목을 필터링 할 수 있습니다.
public partial class Form1 : Form
{
#region Form1()
/// <summary>
/// 생성자 입니다.
/// </summary>
public Form1()
{
InitializeComponent();
List<Sample> item = new List<Sample>();
for (int i = 0; i < 5; i++)
{
item.Add(new Sample()
{
Name = "Sample" + i.ToString()
});
}
this.checkedListBoxControl1.DataSource = item;
this.checkedListBoxControl1.DisplayMember = "Name";
this.checkedListBoxControl1.CheckMember = "Check";
CreateSearchControl();
}
#endregion
#region CreateSearchControl()
/// <summary>
/// SearchControl을 생성합니다.
/// </summary>
private void CreateSearchControl()
{
this.searchControl1.Client = this.checkedListBoxControl1;
this.searchControl1.Name = "searchControl1";
this.searchControl1.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[]
{
new DevExpress.XtraEditors.Repository.ClearButton(),
new DevExpress.XtraEditors.Repository.SearchButton()
});
this.searchControl1.Properties.Client = this.checkedListBoxControl1;
this.searchControl1.Size = new System.Drawing.Size(255, 20);
}
#endregion
}
public class Sample
{
/// <summary>
/// 이름 입니다.
/// </summary>
public string Name { get; set; }
/// <summary>
/// 체크 여부 입니다.
/// </summary>
public bool Check { get; set; }
}
728x90
댓글