We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

SkinManager on Derived WPF controls

Thread ID:

Created:

Updated:

Platform:

Replies:

94341 May 7,2010 12:20 PM May 13,2010 03:34 AM WPF 3
loading
Tags: Tools
Qingde Shi
Asked On May 7, 2010 12:20 PM

Hi,

I understand the SkinManager can be applied to Syncfusion controls and WPF framework controls. How to make the SkinManager apply to the controls that derived from WPF controls? for example:

public class TestButton : Button
{
public TestButton():base()
{

}
}

I see the TestButton does not get the skin applied to when used in UserControls. and I have loaded resource SkinManager.xaml into the App.xaml.

Thanks,

Q

Michael Matela
Replied On May 10, 2010 03:16 AM

The skins are applied via a ResourceDictionary. Due to WPF-inheritance rules, visual children of an item with the SkinManager set will also get the skins. So if you have a top-level window with XAML such as the following and you add your button to it, it will also get the skin:









You can also add this to your button's XAML, so the skins will always work. Note that the SkinManager.xaml is currently very large, so parsing it takes quite some time. Thus, it is best to have it only on top-level windows.

Qingde Shi
Replied On May 10, 2010 09:28 AM

Thanks for the reply, however, it does not work. like I said in the first post, I have put the SkinManager.xaml in the App.xaml resources, and I also tried like what you said put the SkinManager.xaml resource in the window itself, but the derived controls just not get the skin applied, while the framework controls get applied perfectly.

Mayavel K [Syncfusion]
Replied On May 13, 2010 03:34 AM

Hi Qingde,

Thanks for your interests in Syncfusion products.

Skin Manager contains styles for all the framework and our controls.
When we merge Skin Manager in application, it will merge all the controls styles as resource and it will get apply automatically through resource lookup logic in WPF.
When you write a new style to a control, it usually overwrites the existing skin style and you will get only the new skin style.
Even though it inherit from that control. To overcome this, you should specify the BasedOn property while writing style for the control. By using this property, you can get both the existing skin style as well as the custom control style for the control.


The below code snippet will illustrates this:



Please let us know if you have any questions,

Thanks,
Mayavel K

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;