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

Propagating GridViewCheckBoxColumn selection to DataMemberBinding in edit mode

3 Answers 245 Views
GridView
This is a migrated thread and some comments may be shown as answers.
arto
Top achievements
Rank 1
arto asked on 09 Jul 2014, 09:33 PM
Hi,

I have a RadGridView with a GridViewCheckBoxColumn defined like so:
<telerik:GridViewCheckBoxColumn AutoSelectOnEdit="True" DataMemberBinding="{Binding Selected, Mode=TwoWay}" EditTriggers="CellClick" />

The checkbox autoselect works as expected - one click checks or unchecks it.

I need the Selected property, bound to DataMemberBinding, to get notified/called any time checkbox check/uncheck happens. In my case this does not happen when the cell is in edit mode. So I click the cell, the check box gets checked, but no notification goes to the Selected property until I click on some other cell.
Looks like the event doesn't get sent to the bound property while the cell is in edit mode, even though the check box gets checked, only after leaving the edit mode the property gets the notification.
How can this be fixed so that one click both checks the checkbox and notifies my Selected property without having to leave the cell?

Really appreciate the help!


3 Answers, 1 is accepted

Sort by
0
arto
Top achievements
Rank 1
answered on 09 Jul 2014, 10:44 PM
This code actually works as I expect, one click checks the checkbox and the model gets notified, but in this case the column is not filterable anymore, even though I tried IsFilterable=true, any way to fix this?
<telerik:GridViewDataColumn Width="30">
                                        <telerik:GridViewDataColumn.CellTemplate>
                                            <DataTemplate>
                                                <CheckBox IsChecked="{Binding Selected, Mode=TwoWay}" />
                                            </DataTemplate>
                                        </telerik:GridViewDataColumn.CellTemplate>
                                    </telerik:GridViewDataColumn>
0
arto
Top achievements
Rank 1
answered on 09 Jul 2014, 11:20 PM
looks like this is the solution, please let me know if you can think of a better solution, thanks!
<telerik:GridViewDataColumn Width="70"
                                                               DataMemberBinding="{Binding Selected}"
                                                               Header=""
                                                               IsResizable="False">
                                       <telerik:GridViewDataColumn.CellTemplate>
                                           <DataTemplate>
                                               <CheckBox IsChecked="{Binding Selected, Mode=TwoWay}" />
                                           </DataTemplate>
                                       </telerik:GridViewDataColumn.CellTemplate>
                                   </telerik:GridViewDataColumn>
0
Yoan
Telerik team
answered on 14 Jul 2014, 07:43 AM
Hello,

Indeed this is the workaround that we can suggest. However, I will further investigate the case and I will contact you back with more information.


Regards,
Yoan
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
arto
Top achievements
Rank 1
Answers by
arto
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or