You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I put ToggleSwitches in standard WPF DataGrid. The grid uses row virtualization. I have also set CheckedCommand/UnCheckedCommand.
Now when the grid is rendered and I scroll in the grid, the check/unchecked commands get called.
I suspect this is caused by virtualization - when an already rendered control gets reused for another row which has the toggle set to the opposite value, the control is "toggled" and the command is triggered.
With virtualization off, this doesn't happen, but it is quite a significant performance hit in my case.
Expected outcome
Checked/UnChecked command should not be triggered since the underlying DataModel has not changed and the user hasn't toggled the switch.
Environment
MahApps.Metro 1.3.0
Windows 10
Visual Studio 2015
.NET Framework 4.5
The text was updated successfully, but these errors were encountered:
j-maly
changed the title
ToggleSwitch - commands triggered when grid is virtualized
ToggleSwitch - commands triggered wrongly when grid is virtualized
Dec 10, 2016
@j-maly I tried to make a DataGridToggleSwitchColumn but get the same result, that the IsChecked property is set if the row is coming in to the view. I saw by inspected the DataGridCheckBoxColumn that this is also happening there, except the commands cause the CheckBox doesn't has this, but the IsChecked property is also set an unset like the ToggleSwitch. So I came to the point that this is maybe not fixable (not in an easy way).
@j-maly The only way is to change these commands from value changed commands to only user changed commands (when the user clicked on it), but this is a breaking change.
What steps will reproduce this issue?
I put ToggleSwitches in standard WPF DataGrid. The grid uses row virtualization. I have also set CheckedCommand/UnCheckedCommand.
Now when the grid is rendered and I scroll in the grid, the check/unchecked commands get called.
I suspect this is caused by virtualization - when an already rendered control gets reused for another row which has the toggle set to the opposite value, the control is "toggled" and the command is triggered.
With virtualization off, this doesn't happen, but it is quite a significant performance hit in my case.
Expected outcome
Checked/UnChecked command should not be triggered since the underlying DataModel has not changed and the user hasn't toggled the switch.
Environment
The text was updated successfully, but these errors were encountered: