Checkbox Functionality for SL UI Grid?

Answered (Verified) This post has 1 verified answer and 2 replies

Top 150 Contributor
Posts: 47
mlow01 Posted: Mon Sep 12, 2011 @ 12:14 AM

Are there any examples available of using checkboxes within the SL 2011 UI DataGrid? I saw this post, but I don't think it's for this particular grid:  http://www.componentart.com/kb/article.aspx?id=10128

When I click on the "See Checkbox Columns in ComponentArt Grid" link, it just directs me off to the main documentation page. Any help with this would be greatly appreciated. Thanks.

Matt

Answered (Verified) Verified Answer

Top 10 Contributor
Posts: 908
Answered (Verified) ajay Posted: Mon Sep 12, 2011 @ 4:16 AM
Verified by mlow01

Hello,

 

Thank you for submitting your query with ComponentArt forum.

 

For this, you can use a templated column. The template can contain a CheckBox whose checked setting you can bind to the underlying Boolean value with the usual "Binding" syntax.

 

Below is a sample code to implement checkbox column in SilveLight datagrid. In the below code boolean field called IsMember is coming from data source, and it's bound to the column containing a checkbox like this:

 

 <cart:DataGridTemplateColumn Header="Is Member?" Width="100" Binding="{Binding IsMember}">
                    <cart:DataGridTemplateColumn.CellTemplate>

                        <DataTemplate>

                           <CheckBox IsChecked="{Binding}"></CheckBox>

                        </DataTemplate>

                    </cart:DataGridTemplateColumn.CellTemplate>

                </cart:DataGridTemplateColumn>

 

You can also refer the following online help article for the same:

 

http://docs.componentart.com/default.aspx?content=ComponentArt.Web.UI.Silverlight.server/ComponentArt.Silverlight.UI.Data~ComponentArt.Silverlight.UI.Data.DataGridCheckBoxColumn.html#UIFramework/2011/ComponentArt.Web.UI.Silverlight.server/ComponentArt.Silverlight.UI.Data~ComponentArt.Silverlight.UI.Data.DataGridCheckBoxColumn.html

 

I hope this helps.

 

Thank you.

 

Ajay Mishra

All Replies

Top 10 Contributor
Posts: 908
Answered (Verified) ajay Posted: Mon Sep 12, 2011 @ 4:16 AM
Verified by mlow01

Hello,

 

Thank you for submitting your query with ComponentArt forum.

 

For this, you can use a templated column. The template can contain a CheckBox whose checked setting you can bind to the underlying Boolean value with the usual "Binding" syntax.

 

Below is a sample code to implement checkbox column in SilveLight datagrid. In the below code boolean field called IsMember is coming from data source, and it's bound to the column containing a checkbox like this:

 

 <cart:DataGridTemplateColumn Header="Is Member?" Width="100" Binding="{Binding IsMember}">
                    <cart:DataGridTemplateColumn.CellTemplate>

                        <DataTemplate>

                           <CheckBox IsChecked="{Binding}"></CheckBox>

                        </DataTemplate>

                    </cart:DataGridTemplateColumn.CellTemplate>

                </cart:DataGridTemplateColumn>

 

You can also refer the following online help article for the same:

 

http://docs.componentart.com/default.aspx?content=ComponentArt.Web.UI.Silverlight.server/ComponentArt.Silverlight.UI.Data~ComponentArt.Silverlight.UI.Data.DataGridCheckBoxColumn.html#UIFramework/2011/ComponentArt.Web.UI.Silverlight.server/ComponentArt.Silverlight.UI.Data~ComponentArt.Silverlight.UI.Data.DataGridCheckBoxColumn.html

 

I hope this helps.

 

Thank you.

 

Ajay Mishra

Top 150 Contributor
Posts: 47
mlow01 Posted: Mon Sep 12, 2011 @ 8:11 AM
Thanks Ajay, that worked perfectly!

Matt
Page 1 of 1 (3 items)