The “UIHint” Decorator

Today’s discover was a handy csharp decorator, the “UIHint”.

uihtin

The string is the name of the template that we want to call.

Next in our view we call the displayFor and we pass the Color property.

view

Looking good, but we still need to call our template. So we create a folder called “DisplayTemplates” and inside we add a new View with the same name as the string in our decorator, in this case “ColorTemplate”.

folders

And finally inside our template view we just need to say what we want.

for example ,use the properties of our model to pass as arguments to the style of our div.

view2

 

End

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s