Changing Styles using ImplicitStyleManager

Posted on October 29, 2008. Filed under: Silverlight | Tags: |

A bunch of new controls were released yesterday as part of silverlight toolkit. One of new Items is ImplicitStyleManager which simplifies changing styles. You can download the sample here. It doesnt do anything meaningful but shows how we can dynamically change styles in the application.

Here are some screenshots

Make a Comment

Make A Comment: ( 11 so far )

blockquote and a tags work here.

11 Responses to “Changing Styles using ImplicitStyleManager”

RSS Feed for Lee’s corner Comments RSS Feed

[...] Lee gives us a really nice and simple demo on Changing Styles using ImplicitStyleManager [...]

Hi.Lee

Could you give us a toolkit datagrid sample please?

I found that the themes doesn’t style the datagrid,Why?

[...] 13, 2008 by lee In an earlier post we saw it was easy to change styles using ImplicitStyleManager. But TabControl and DataGrid were [...]

Super cool, I have a web site(http://www.xamltemplates.net) were i sell themes (skins) for all the WPF controls, now i cand make also for silverlight :D , thanks again.

Hi Lee, I have gone thru ur application and the code behind for it. I am new to Silverlight toolkit and Themes. Could you kindly explain ur code step by step if possible.

Thanks

what piece(s) of code are you having difficulty with

Hi Lee. Understood ur code well thoroughly. Was a little mentally tired yesterday, so probably the code could not register properly. Well I am working with “Microsoft.Cui.Controls”(http://www.mscui.net/Components/PatientBanner.aspx) Patient Banner control.

Is there anyway I can apply the theme styling(from ur code sample) to the Patientbanner control. Have been on this issue for a week now.
I tried using it as one of the child controls inside ur application, but the control did not reflect the required styles of the theme selected.

I would try to explicity set the theme on the child control and see

Hi currently this is the “xaml file”

xmlns:theming=”clr-namespace:Microsoft.Windows.Controls.Theming;assembly=Microsoft.Windows.Controls.Theming”>

<!–
–>

By explicitly setting the theme you mean setting it in the XAML code is it or in the C# backend code. Can u plz reply back with a sample code for the same.

you could replace the “this” with the control name

ImplicitStyleManager.SetResourceDictionaryUri(this, new Uri(@”projname;component/Theme.xaml”, UriKind.Relative));
ImplicitStyleManager.SetApplyMode(this, ImplicitStylesApplyMode.Auto);
ImplicitStyleManager.Apply(this);

No Lee,

Adding ‘this’ keyword instead of the control name gives the same result i.e. ‘Silverlight XAML Controls’ are coming out properly skinned/themed by the applied theme. Its just the PatientBanner control which is not complying to the Theme set by me.

Can u try this out if possible and let me know. I really think that Silverlight toolkit which supports common Silverlight XAML controls does not support Microsoft.Cui.Controls. Lemme know ur thoughts on the same. Thanks for ur time :-)


Where's The Comment Form?

Liked it here?
Why not try sites on the blogroll...