non conditional silverlight xamgrid cell formating,
just set cell background color regardless of the cell value ?
Not using LessThanConditionalFormatRule etc.
for
ig:XamGrid
v2.0.50727
11.2.20112.2068
InfragisticsSL4.Controls.Grids.XamGrid.v11.2
Thank you, all questions was answered.
Hi,
Yes, you are correct there is no AltBackground property for the CellControl and if you don’t want to disable the alternate rows, you only option is to retemplate the CellControl class as described in this sample project: http://samples.infragistics.com/sllob/RunSamples.aspx?cn=grid#/grid/alternate-row-styling
Please let me know if there is anything else I can do for you.
Little correction : Style styleR = new Style(typeof(CellControl)); and there is no crash, but how can the ALT rows be set ? No CellControl.AltBackgroundProperty exists like it is in the ConditionalFormattingCellControl.AltBackgroundProperty case ?
...In your particular case you can use a style for the CellControl and set it to the XamGrid’s CellStyle property.
So this snippet of code is what you have suggested and what we need :
void grid_InitializeRow(object sender, InitializeRowEventArgs e) { Color backcolorR = new Color(); backcolorR.A = 255; backcolorR.R = 255; backcolorR.G = 0; backcolorR.B = 0;
SolidColorBrush sbBackGroundR = new SolidColorBrush(backcolorR);
Style styleR = new Style(); Setter setterR = new Setter(); setterR.Property = CellControl.BackgroundProperty; setterR.Value = sbBackGroundR; styleR.Setters.Add(setterR);
try { e.Row.Cells[0].Style = styleR; } catch (Exception ex) { show...ex.Message; } }
the silverlight application crashes (outside of grid_InitializeRow function) with the error
Microsoft JScript runtime error: Unhandled Error in Silverlight Application Code: 4004 Category: ManagedRuntimeError Message: System.InvalidOperationException: System.InvalidOperationException: System.InvalidOperationException: Must have non-null value for TargetType....
I have been looking into your requirement and in order to style the XamGrid I can suggest you go through the online documentation’s designer’s guide: http://help.infragistics.com/NetAdvantage/Silverlight/2011.2/CLR4.0/?page=SL_DesignersGuide_Styling_Points_for_xamGrid.html . Here you can find the styles targeted for the different elements and areas and the properties they can be set through. In your particular case you can use a style for the CellControl and set it to the XamGrid’s CellStyle property.
Please let me know if I can be of any further assistance on the matter.