Is it possible to dynamically change the style/template of a control?

Posted by elggarc on Stack Overflow See other posts from Stack Overflow or by elggarc
Published on 2010-06-09T12:00:39Z Indexed on 2010/06/09 12:42 UTC
Read the original article Hit count: 167

I am creating a UserControl in Silverlight 4 which has a watermarked background.

The watermark should change depending on the underlying 'type' the UserControl is representing.

The watermark is created using a Path and I have extracted all the properties into a style.

I was wondering if it would be possible to change the style of the Path at runtime based on some known value.

I am using MVVM and Unity. Perhaps I could bind the style somehow? Or could I inject the style when the view is created?

I may have to do this with control templates, hence the reference in the title.

Thanks...

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about styles