Describe the bug
When using ui:DataGrid, even if IsReadOnly="True" is set for DataGridCheckBoxColumn, the checkbox can still be changed.
To Reproduce
- Use ui:DataGrid, add DataGrid.Columns, add DataGridCheckBoxColumn, and set a data source for DataGrid.
- Set property IsReadOnly="True" to DataGridCheckBoxColumn.
- Run the app.
- You can see that the checkbox inside DataGridCheckBoxColumn can still be modified to change its checked state.
Expected behavior
While IsReadOnly="True", the checkbox inside DataGridCheckBoxColumn should be ReadOnly.
Screenshots
No response
OS version
Windows 10, Version 19045.3031
.NET version
.NET 6
WPF-UI NuGet version
3.0.0-preview.4
Additional context
It seems there is a potential solution available at: https://stackoverflow.com/a/37584805
Currently, I am using the following workaround to bypass this bug.
First, add the following style in the resources:
<Style x:Key="DataGridCheckBoxColumnStyle" BasedOn="{StaticResource DataGridCheckBoxElementDefaultStyle}" TargetType="{x:Type CheckBox}">
<Setter Property="IsHitTestVisible" Value="False"/>
</Style>
Then apply the style to the DataGridCheckBoxColumn:
<DataGridCheckBoxColumn ElementStyle="{StaticResource DataGridCheckBoxColumnStyle}" />
The drawback is that the checkbox requires two clicks to be modified.
Describe the bug
When using ui:DataGrid, even if IsReadOnly="True" is set for DataGridCheckBoxColumn, the checkbox can still be changed.
To Reproduce
Expected behavior
While IsReadOnly="True", the checkbox inside DataGridCheckBoxColumn should be ReadOnly.
Screenshots
No response
OS version
Windows 10, Version 19045.3031
.NET version
.NET 6
WPF-UI NuGet version
3.0.0-preview.4
Additional context
It seems there is a potential solution available at: https://stackoverflow.com/a/37584805
Currently, I am using the following workaround to bypass this bug.
First, add the following style in the resources:
Then apply the style to the DataGridCheckBoxColumn:
The drawback is that the checkbox requires two clicks to be modified.