T. Answer Fabre did not help me. In my case, I have buttons and editable flags for each row of my datagrid, so they will not be deactivated even if the DataGrid is in ReadOnly. However, what worked for me (without disabling scrolling) disables each line, as in this example:
<Style TargetType="{x:Type DataGridRow}" x:Key="MyDataGridRowStyle"> <Style.Setters> <Setter Property="IsEnabled" Value="False"/> </Style.Setters> </Style>
And then in the DataGrid:
<DataGrid ... RowStyle="{StaticResource MyDataGridRowStyle}">
Hope this helps (sorry if only posted a XAML solution)!
source share