Saturday, May 15, 2010

Silverlight 4 modify style runtime - using new BasedOn property of Style

You can create a new style based on a specific Style.
Setter of your new style has priority high. Other setter will be merged from the basedOn style.

Suppose you have style like below:
And applied like below:











Default Output:

Now in the Button event we can modify the style like below:
















Suppose you have another boder style and want to use some setter.
Suppose the Style2 like below:

Now in the button event you can merge two style like below:

Check demo below:




1 comment: