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. Image for the cookie policy date

SkinManager on Derived WPF controls

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

3 Replies

MM Michael Matela May 10, 2010 07:16 AM UTC

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.


QS Qingde Shi May 10, 2010 01:28 PM UTC

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.


MK Mayavel K Syncfusion Team May 13, 2010 07:34 AM UTC

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

Loader.
Live Chat Icon For mobile
Up arrow icon