0

how can i get a list of all Style properties available ?

like in the visual studio desingner mode there's an IntelliSense properties list for each element supported, so as soon as you type style= you get offerd by all available properties.

i would like to have it available as a collection or list in code behind too. shouldn't it be available in a well known .net built in public class ?

i was searching the System.Web.UI.CssStyleCollection but couldn't get it through any method yet. i am sure it is (should be) very simple . thanks in advance !

as explained in msdn :

CssStyleCollection for the specified HTML server control

i was trying to have all available properties not only those applied on a given element or control in a given page. thanks for your comment @Abody97

4

1 に答える 1

1

長い名前の使用を避けるために、ソースのみがHtmlTextWriterStyle Enumerationであることがわかりました

HtmlTextWriterStyle.SomeProperty.ToString()

    public sealed class StlProps
    {
       // in visual studio you can just mark the HtmlTextWriterStyle 
       // hit "F12" to its definition to have a list of properties
       // just copy it as const strings 
      public const string BgColor = "BackgroundColor",
                          BackgroundImage = "BackgroundImage",
                          BorderCollapse = "BorderCollapse", 
                          ...etc'

    }

これにより、次のようにコントロールスタイルを設定できます

controlID.Style.Add(stlProps.BgColor, "value from Color Class");
于 2012-10-08T16:25:22.383 に答える