Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2005
Programmatically get a property value of a component style defined in Appstyling
posted

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

Parents
  • 469350
    Verified Answer
    Offline posted

    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);
    }

Reply Children
No Data