Hi,
An Appstyling isl file has conponentStyle for UltraGrid:
<componentStyle name="UltraGrid" useFlatMode="True"> <radioButtonGlyphInfo>Office2010RadioButtonGlyphInfo</radioButtonGlyphInfo> <properties> <property name="DefaultSelectedBackColor" colorCategory="{Default}">Silver</property> <property name="FixedCellSeparatorColor" colorCategory="{Default}">Silver</property> <property name="SelectionOverlayBorderColor" colorCategory="{Default}">Gray</property> <property name="SelectionOverlayColor" colorCategory="{Default}">Black</property> </properties> </componentStyle>
How can I programmatically get the value of a property, for example, FixedCellSeparatorColor?
Thanks,Shaolin
ApplicationStyleLibrary styleLibrary = new ApplicationStyleLibrary(); styleLibrary.LoadFromStyleManager(); StyleSetSettings styleSet = null; if (styleLibrary.StyleSets.Count > 0 && styleLibrary.DefaultStyleSet != null) styleSet = styleLibrary.StyleSets[styleLibrary.DefaultStyleSet]; if (styleSet == null) { styleSet = styleLibrary.StyleSets.Add("Default"); styleLibrary.DefaultStyleSet = styleSet.Key; } var gridComponentRole = styleSet.ComponentStyles.GetComponentStyle("UltraGrid", false); if (null != gridComponentRole) { var fixedCellSeparatorColor = gridComponentRole.CustomProperties["FixedCellSeparatorColor"]; Debug.WriteLine(fixedCellSeparatorColor); }
ApplicationStyleLibrary styleLibrary = new ApplicationStyleLibrary(); styleLibrary.LoadFromStyleManager();
StyleSetSettings styleSet = null; if (styleLibrary.StyleSets.Count > 0 && styleLibrary.DefaultStyleSet != null) styleSet = styleLibrary.StyleSets[styleLibrary.DefaultStyleSet];
if (styleSet == null) { styleSet = styleLibrary.StyleSets.Add("Default"); styleLibrary.DefaultStyleSet = styleSet.Key; }
var gridComponentRole = styleSet.ComponentStyles.GetComponentStyle("UltraGrid", false); if (null != gridComponentRole) { var fixedCellSeparatorColor = gridComponentRole.CustomProperties["FixedCellSeparatorColor"]; Debug.WriteLine(fixedCellSeparatorColor); }
Since this has been coming up lately, another avenue is to get the settings directly to the Role's State.
eg.
//app stylist ApplicationStyleLibrary styleLibrary = new ApplicationStyleLibrary(); styleLibrary.LoadFromStyleManager(appStylistRuntime1.StyleLibraryName); StyleSetSettings styleSet = null; if (styleLibrary.StyleSets.Count > 0 && styleLibrary.DefaultStyleSet != null) styleSet = styleLibrary.StyleSets[styleLibrary.DefaultStyleSet]; if (styleSet == null) { styleSet = styleLibrary.StyleSets.Add("Default"); styleLibrary.DefaultStyleSet = styleSet.Key; } var fmComponentRole = styleSet.RoleStyles.GetStyle("UltraPanel", false); if (null != fmComponentRole) { var panelColor = fmComponentRole; ultraLabel2.Appearance.BackColor = panelColor.States[0].Appearance.BackColor; }