I have 20 fields and would like to style all cells of one field in a certain way. I was thinking the following XAML would do the trick, but it does nothing.
<igDP:Field Name="Status"> <igDP:Field.Label> <Label Name="LabelStatus"> <TextBlock TextWrapping="Wrap">Status</TextBlock> </Label> </igDP:Field.Label> <igDP:Field.Settings> <igDP:FieldSettings AllowEdit="False" LabelWidth="80" CellWidth="80"> <igDP:FieldSettings.CellPresenterStyle> <Style TargetType="{x:Type igDP:CellPresenter}"> <Setter Property="Background" Value="Yellow" /> <Setter Property="Foreground" Value="Green" /> <Setter Property="FontSize" Value="16" /> </Style> </igDP:FieldSettings.CellPresenterStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field>
Any ideas as to what might be wrong?
Thanks!
Hello Louis,
It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into it and I can suggest you set the Field’s FieldSettings’ EditorType to be XamNumericEditor like this:
<igDP:Field Name="Name"> <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamNumericEditor}"/> </igDP:Field.Settings> </igDP:Field>
Feel free to write me if you have further questions.
This may be related. I have a XamDataGrid bound to data that has some fields that a of type Decimal. WHen I set AutoGenerateFields=True these decimal fields are rendered with dollar signs ($) in front. However, these values are not currencies they are just scalar quantities so I don't want $ signs in front. How do I style the cell presentation such that it doesn't display the currency symbol? Is there a string format property on the presenter style?
Louis
Good call. I somehow missed that the FieldSettings type has a CellValuePresenterStyle property. Thanks!
Hello,
It is my understanding that it is the CellValuePresenterStyle which needs to be styled to achieve changing the text style in a column of cells.
The following snippet will change the text color and size for all the fields in the specified column. I noticed trying to color the TextBlock background color does not work. More than likely the coloring of the background is overridden in other areas. The CellValuePresenter does alow for modifying several of the background brushes. I've included a Setter for changing the hover color for the background.
<igDP:Field.Settings> <igDP:FieldSettings> <igDP:FieldSettings.CellValuePresenterStyle> <Style TargetType="{x:Type igDP:CellValuePresenter}"> <Setter Property="ForegroundStyle"> <Setter.Value> <Style> <Setter Property="TextBlock.Foreground" Value="Green" /> <Setter Property="TextBlock.Background" Value="Yellow" /> <Setter Property="TextBlock.FontSize" Value="16" /> </Style> </Setter.Value> </Setter> <Setter Property="BackgroundHover" Value="Purple"/> </Style> </igDP:FieldSettings.CellValuePresenterStyle> </igDP:FieldSettings></igDP:Field.Settings>
One suggestion is to send in a feature request asking to simplify the various ways to customize a data grid. http://devcenter.infragistics.com/Protected/RequestFeature.aspx
Thank you