Skip to main content

Microsoft Silverlight

Answered Question Datagrid with checkboxRSS Feed

(0)

Elango.ka
Elango.ka

Participant

Participant

816 points

146 Posts

Datagrid with checkbox

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_lukasz
sokol_lu...

Member

Member

3 points

7 Posts

Re: Datagrid with checkbox

 

Hi, maybe this help you  http://silverlight.net/samples/sl2/toolkitcontrolsamples/run/default.html

ssenthil
ssenthil

Member

Member

501 points

108 Posts

Re: Datagrid with checkbox

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.

 

Elango.ka
Elango.ka

Participant

Participant

816 points

146 Posts

Re: Re: Datagrid with checkbox

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.

Thanks

ssenthil
ssenthil

Member

Member

501 points

108 Posts

Answered Question

Re: Datagrid with checkbox

sample code when clicking button to check all checkbox

this.YorCollection.ForEach(delegate(yourclass yourobject)

{

yourobject.CheckBoxValue =
"true";

});

Note  CheckBoxValue - Your property name

then bind datagrid.Itemsource = this.YorCollection

ssenthil
ssenthil

Member

Member

501 points

108 Posts

Re: Datagrid with checkbox

This is also gud like template column with checkbox

yourobject.Flag= "true";  

Even you can have one checkbox in template coplumn header

 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities