Hai,
When using the xamWebGrid I ran into a frustrating problem. I have about 150 rows in the grid, so naturally the vertical scrollbar will appear. In some situations I want to set the grid to readOnly. If I do that, the scrollbar will also be set to readOnly, so it is not possible to scroll down and see the rest of my data. The same result happens when I separately set all the columns to readOnly. Is there any chance I can scroll through my data when the grid is set to readOnly?
Thanks in advance,
Rixt
Hi,
So, are you setting the xamWebGrid's IsEnabled property? If so, then yes the scrollbar will become disabled.
However, if you're just trying to make it so the grid isn't editable, then you should just be setting:
xamWebGrid.EditingSettings.AllowEditing = EditingType.None;
As for the readonly properties on Columns, they also just determine editing, and should have no effect on the scrollbar. If you're seeing something else, do you think you'd be able to attach a simple sample demonstrating this issue?
Thanks,
-SteveZ
Hi SteveZ,
Thanks for your reply.
I'll explain myself more clearly. When I use the EditSettings.AllowSetting property the templateColumns I use in the grid are still editable and it gives the impression that I still can edit the grid. The isEnabled property is exactly what I need, except for the ScrollBars to disable. Even when I override the IsEnabled property and set the ScrollBar.IsEnabled property back to true, the scrollBar is still disabled.
Setting the columns separately to ReadOnly was my mistake. The IsEnabled property of the grid was called later in a function, that's why the scrollBar was disabled.
I attached a simple sample, that demonstrates the 3
possibilities.
Hi Rixt,
So, this can be easily achieved using the CellStyle property of the Column.
<Style TargetType="ig:CellControl" x:Key="DisableStyle">
<Setter Property="IsEnabled" Value="false"></Setter>
</Style>
To Disable:
this.DataGrid1.Columns["Test"].CellStyle = this.Resources["DisableStyle"] as Style;
To Enable:
this.DataGrid1.Columns["Test"].CellStyle = null;
Hope this helps,
I added this property to our own CellStyle and it works perfect!
Thanks for your help!