Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Datagrid with checkbox
5 replies. Latest Post by ssenthil on July 7, 2009.
(0)
Elango.ka
Participant
816 points
146 Posts
07-07-2009 4:40 AM |
Hi,
I have datagrid with check box column. I need to when i click one button, i want to checked all the checkboxes in datagrid and unchecked also.
How i do this?. Advance thanks for your help.
Thanks
sokol_lu...
Member
3 points
7 Posts
07-07-2009 4:53 AM |
ssenthil
501 points
108 Posts
07-07-2009 5:19 AM |
Keep one bool property in our enetity class default it should be false, bind that property to checkbox column
when u click a button set that property to true and bind again to datagrid.
07-07-2009 5:39 AM |
Hi Senthil,
My code is;
<data:DataGridTemplateColumn Width="30"> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate> <CheckBox IsChecked="{Binding Flag}" HorizontalAlignment="Center"></CheckBox> </DataTemplate> </data:DataGridTemplateColumn.CellTemplate> </data:DataGridTemplateColumn>
Im using here Template columns. How to use checkbox column and how to bind there, can you please explain to me.
07-07-2009 5:40 AM |
sample code when clicking button to check all checkbox
{
});
Note CheckBoxValue - Your property name
then bind datagrid.Itemsource = this.YorCollection
07-07-2009 5:48 AM |
This is also gud like template column with checkbox
yourobject.Flag= "true";
Even you can have one checkbox in template coplumn header