This is a migrated thread and some comments may be shown as answers.

Bound Checkbox

2 Answers 89 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Terry
Top achievements
Rank 1
Terry asked on 24 Jun 2010, 05:15 PM
Hi:

I have a checkbox column in a grid bound to a bit value in a SQL Server database.  As I understand it, there is no basic checkbox column type that I can bind to the database, so I've created a cell template and a cell edit template as follows:

                    <radGridView:GridViewDataColumn Header="Active?" 
                                             Width="Auto" 
                                             TextAlignment="Center" > 
                        <radGridView:GridViewDataColumn.CellTemplate> 
                            <DataTemplate> 
                                <CheckBox x:Name="chkActive"   
                                         IsChecked="{Binding ProjActive, Mode=TwoWay}" 
                                         HorizontalAlignment="Center"/>  
 
                            </DataTemplate> 
                        </radGridView:GridViewDataColumn.CellTemplate> 
                         <radGridView:GridViewDataColumn.CellEditTemplate> 
                            <DataTemplate> 
                                <CheckBox x:Name="chkActive"   
                                         IsChecked="{Binding ProjActive, Mode=TwoWay}" 
                                         HorizontalAlignment="Center"/>  
 
                            </DataTemplate> 
                        </radGridView:GridViewDataColumn.CellEditTemplate> 
                    </radGridView:GridViewDataColumn> 
 

This works, but visually it looks really weird.  When the checkbox cell goes into edit mode, it becomes so small it is hard to see (see attached screenshot).  This only happens when the row is in edit mode and I tab into the field from the previous column.  Otherwise, I can check or uncheck the checkbox simply by clicking on it and the size stays the same.  Can you tell me why this is happening?

Thanks,

Terry

2 Answers, 1 is accepted

Sort by
0
Accepted
Yavor Georgiev
Telerik team
answered on 25 Jun 2010, 09:51 AM
Hi Terry,

 Could you please try with a GridViewCheckBoxColumn and share your results?

Kind regards,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Terry
Top achievements
Rank 1
answered on 27 Jun 2010, 01:51 AM
That worked, Georgiev.  Thanks!  GridViewCheckBoxColumn was not available with the version I was running -- at least I didn't see it in intellisense.  When I upgraded to the latest version it became visible and solved my problem.
Tags
GridView
Asked by
Terry
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Terry
Top achievements
Rank 1
Share this question
or