I am new to the SilverLight control world BUT have been using the Win version for years. I need to be able to dynamically change the formatting on cells that are being returned in the Grid. I have code that works great on the desktop and I format columns dynamically based on what gets returned, but I dont see the same types of capabilities in XamGrid :( I am sure there is another way to do it but here is an example in WinGrid
With Grid.DisplayLayout.Bands(0).Columns(0)
.Style = UltraWinGrid.ColumnStyle.Currency
.CellAppearance.TextHAlign = HAlign.Right
.Format =
"###,###.00"
End With
how do I do the same thing dynamically in SilverLight Xamgrid??
This post have more information on the .FormatString
http://community.infragistics.com/forums/p/49691/262068.aspx#262068
Is all the data in the column one data type? The TextColumn (the default column type) has a FormatString off it which can be set to a valid format string for the data.
That would probably be the most comparable to the .Format property from the WinGrid.
From what you pointed me to, how do I set the columns display format to be a Date, or Currency , or Percent Format etc? I am not getting it from what I saw in the Conditional formatting document. It may be the same, but I just need things like being able to say, "Set this column to a date format", set this one to Currency, etc. I already know based on the column being returned what to do (since I do some things in the naming of it in SQL)
I started going down the path of the CellStyle, but it crashes (probably because I am guessing too much :) )
style =
new Style(typeof(XamMaskedEditor));
setter =
new Setter(XamMaskedEditor.MaskProperty, "$###,###.00");
style.Setters.Add(setter);
column.CellStyle = style;
Ohhhhhh the fun of learning new things :)
The recommended way to do this is by using the grids Conditional Formatting feature:
http://help.infragistics.com/NetAdvantage/Silverlight/2010.3/CLR4.0/?page=xamGrid_Conditional_Formatting.html
Enable CF in the grid, create a style that targets the COnditionalFormattingCellControl and assign it to the rules StyleToApply property.
http://help.infragistics.com/NetAdvantage/Silverlight/2010.3/CLR4.0/?page=InfragisticsSL4.Controls.Grids.XamGrid.v10.3~Infragistics.Controls.Grids.ConditionalFormattingCellControl.html
Devin