Is there an "extended" UIHint attribute to apply CSS styles for DisplayFor - EditorFor templates?
Posted
by AJ
on Stack Overflow
See other posts from Stack Overflow
or by AJ
Published on 2010-04-01T13:36:26Z
Indexed on
2010/04/03
7:13 UTC
Read the original article
Hit count: 333
Intro: After reading Brad Wilson Metadata series and searching unsuccesfully on google, I was wondering:
Question: Has any OS project / code been created that allows you to tag CSS styles in the Meta information, for example in my (buddy) Model, I want to be able to decorate a property with multiple CSS styles (a single style you can fake with UIHint, I want to set many possible styles - and be able to "cross-utilise")
eg.
public class MyModel
{
[DisplayCssHint("h5")]
[DisplayCssHint("color:#777;")]
[EditorCssHint(".myCoolTextClass")]
[EditorCssHint(".myOtherCoolTextClass")]
public string Title{ get;set; }
[DisplayCssHint(".normaltext")]
[EditorCssHint(".myCoolTextClass")]
[EditorCssHint(".myOtherCoolTextClass")]
public string Message {get;set;}
}
Thoughts: I know that this does not seem like a logical place to put styling information, however as it is metadata and is discriptive... besides it would be nice to do this while prototyping - (especially being able to apply class styles and extending it further - to generate .Less files would really be cool! more to the point I would hate to write it, if its already been done ;). Any links/pointers/idea's would be appreciated.
Thanks,
© Stack Overflow or respective owner