home screen

Search



Number Of Result : 0

Result :


Wednesday, October 15, 2008

Tạo 1 ListCheckBox từ ListBox

Tạo ra 1 ListBox có hỗ trợ dấu check (giả lập khi Item này được select)

Style cho ListBoxItem



Có thể thay Content="{Binding Path = Name}" thành Content="{TemplateBinding Content}" nếu muốn hiển thị nội dung sẵn có trên ListBox thay vì Binding dữ liệu

Cách sử dụng

 >   



//080904: Thanks Hạnh (Sau 1 hồi lụi ơi là lụi mới nhớ mình đã ghi lại ControlTemplate này :d)

Set Check:

public void Show_AuthorOfBookTitle(LLBL.AuthorEntity[] Authors)
{
//Todo: Code atfer
if (Authors == null)
return;
foreach (LLBL.AuthorEntity a in Authors)
{
ListCheckBox_Author.SelectedItems.Add;//Hay bắt cứ dạng Data nào da được Binding với ListBox
}
}



Bắt SeletectionChanged

private void ListCheckBox_Author_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
//Xử lí tùy thích. e chứa danh sách Item vừa dc thêm hay Remove
}

reference to : http://truonglekhanh270983.googlepages.com/checklistbox_styelistboxitem

No comments: