Propagating GridViewCheckBoxColumn selection to DataMemberBinding in edit mode

4 posts, 0 answers
  1. arto
    arto avatar
    12 posts
    Member since:
    Jun 2014

    Posted 09 Jul 2014 Link to this post

    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!


  2. arto
    arto avatar
    12 posts
    Member since:
    Jun 2014

    Posted 09 Jul 2014 in reply to arto Link to this post

    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>
  3. arto
    arto avatar
    12 posts
    Member since:
    Jun 2014

    Posted 09 Jul 2014 in reply to arto Link to this post

    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>
  4. Yoan
    Admin
    Yoan avatar
    1213 posts

    Posted 14 Jul 2014 Link to this post

    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.
     
Back to Top