This question is locked. New answers and comments are not allowed.
Hey,
I'm having some trouble with a Telerik RadGridView where I want to be able to tell if the user clicked a checkbox vs. it being set via the binding. This is so I can set a "dirty" status and let them know they have made changes that require saving.
My first approach:
1) Set a loading=true flag when I'm about to bind to my collection of objects
2) Set loading=false in the DataLoaded event
3) on checkbox_checked event, as long as loading=false it is the user, not a binding causing the change in value
This approach did not work. I get the DataLoaded event, and then a short while later I get the checkbox_checked event for any rows that are bound to a "true" value. Is there a reason DataLoaded fires before the checkboxes get checked? I assumed DataLoaded would only fire once all binding/setting of values was complete. Note that I have turned on/off IsSynchronizedWithCurrentItem, and also made sure DataLoadMode is Synchronous.
The second approach was to try to trap a mouseup/down event on the checkbox itself, as that way I know it's the user, not a binding changing the value. Unfortunately I do not receive these mouse events (I assume they are gobbled up by the grid?)
Here is the declaration of the Grid in case you can spot a mistake I am making:
Any help on this would be appreciated!
Nathan
I'm having some trouble with a Telerik RadGridView where I want to be able to tell if the user clicked a checkbox vs. it being set via the binding. This is so I can set a "dirty" status and let them know they have made changes that require saving.
My first approach:
1) Set a loading=true flag when I'm about to bind to my collection of objects
2) Set loading=false in the DataLoaded event
3) on checkbox_checked event, as long as loading=false it is the user, not a binding causing the change in value
This approach did not work. I get the DataLoaded event, and then a short while later I get the checkbox_checked event for any rows that are bound to a "true" value. Is there a reason DataLoaded fires before the checkboxes get checked? I assumed DataLoaded would only fire once all binding/setting of values was complete. Note that I have turned on/off IsSynchronizedWithCurrentItem, and also made sure DataLoadMode is Synchronous.
The second approach was to try to trap a mouseup/down event on the checkbox itself, as that way I know it's the user, not a binding changing the value. Unfortunately I do not receive these mouse events (I assume they are gobbled up by the grid?)
Here is the declaration of the Grid in case you can spot a mistake I am making:
| <telerikGridView:RadGridView x:Name="dgUserPrefs" |
| DataLoadMode="Synchronous" |
| ColumnWidth="*" |
| AutoGenerateColumns="False" |
| ShowGroupPanel="False" |
| IsFilteringAllowed="False" |
| IsReadOnly="True" |
| HorizontalAlignment="Stretch" |
| CanUserReorderColumns="False" |
| CanUserSortColumns="False" |
| CanUserSelect="True" |
| CanUserResizeColumns="False" |
| RowIndicatorVisibility="Collapsed" |
| Margin="3" |
| IsSynchronizedWithCurrentItem="False" |
| > |
| <telerikGridView:RadGridView.Columns> |
| <telerikGridView:GridViewDataColumn Header="Shift Type" DataMemberBinding="{Binding SHIFT_TYPE_DESC}" UniqueName="Shift Type"></telerikGridView:GridViewDataColumn> |
| <telerikGridView:GridViewDataColumn Header="Preference" UniqueName="Preference" HeaderTextAlignment="Center" |
| <telerikGridView:GridViewDataColumn.CellTemplate> |
| <DataTemplate> |
| <CheckBox x:Name="chBoxPriority" |
| IsChecked="{Binding PRIORITY, Mode=TwoWay}" |
| Checked="chBoxPriority_Checked" |
| MouseLeftButtonDown="chBoxPriority_MouseLeftButtonDown" |
| HorizontalAlignment="Center"/> |
| </DataTemplate> |
| </telerikGridView:GridViewDataColumn.CellTemplate> |
| </telerikGridView:GridViewDataColumn> |
| </telerikGridView:RadGridView.Columns> |
| </telerikGridView:RadGridView> |
Any help on this would be appreciated!
Nathan