In xamDataGrid, can I get a column containing read-write properties to behave the same was as read-only properties do? I have set the field to be read-only, and whereas it's true that the value can't be edited, the field does appear differently when it has focus. This does not happen with fields based on read-only properties. Assuming it's relatively easy (i.e. without having to create templates for different states), how would I do that?
Thanks!
Brad.
Hello Brad,
Thank you for posting!
I have been looking into your post. If you would like the Field, that is read-only and the property is not, to be grayed out I can suggest setting the IsEnabled property of the Field itself. This way the cell of the Field would be appear with a gray background.
If this suggestion does not satisfy your need, would you please provide me with more details on what appearance the Field should have and how it should behave, when the IsReadOnly property is set and the property to which the Field is bound is not read-only?
Looking forward to hearing from you.
Setting "IsEnabled" to false definitely sets the behavior to what I'd like. However, I'm not so happy about the gray background and lighter text. I'm thinking maybe creating a "disabled" style that includes changing the background and text colors might fit the bill perfectly. If you get a chance to post that kind of thing before I get it working, that would be great!
Thank you for the feedback.
Here is an example of the style, that can be set to change the appearance of the cells when the 'IsEnabled' property is set for a Field. In this style I create a trigger to set the desired properties only if the 'IsEnabled' property is set to 'False':
<Style TargetType="{x:Type igDP:CellValuePresenter}">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="Red"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
Please do not hesitate to let me know if you have any further questions on this matter.
I should have been much more clear as to what I need. I know how to set the properties for a disabled field. What I don't know is what the properties are for a field that is read-only. I can guess that the background should be white, but maybe it's transparent, or maybe (more likely) it's a system color or something.
I have been looking into your post.
Would you please provide me with a screenshot of the appearance you want to achieve for the XamDataGrids Field when the 'IsEnabled' property is set to false.
This way I would be able to further investigate this matter for you and provide you with further information on this matter.
Thank you for the feedback. I am glad, that you have found a solution to your issue.
Thanks for your help, but I have this working already. :)