Greetings,
I've been tasked with setting up a Silverlight control set for our company's developers for use throughout multiple projects. Each control in this set will wrap either a Telerik or standard Silverlight control. For example, the control set will contain an ESCButton class which derives from System.Windows.Controls.Button, an ESCCheckBox class which derives from System.Windows.Controls.CheckBox, an ESCComboBox which derives from RadComboBox, etc - you get the idea...We're trying to take this approach in case a particular control needs some non-standard functionality that we can implement and all projects will be able to benefit with no additional effort. Make sense?
To make matters a little more interesting, these controls need to share a common 'theme' that will be customized at a later date... As a starting point, I took the Generic.xaml from the Telerik.Windows.Themes.Vista dll and placed it inside the assembly for our custom control set under a folder named Themes. My question is... Without modifying each Style's TargetType attribute in the massive Generic.xaml (which exceeds 20,000 lines), is there any way to link the style of the base controls (e.g. System.Windows.Controls.Button, System.Windows.Controls.CheckBox, RadComboBox) with our extended controls? Hopefully, the following snippet will help you understand what I am trying to accomplish:
public class ESCCheckBox : System.Windows.Controls.CheckBox
{
/// <summary>
/// Initializes a new instance of the ESCCheckBox class.
/// </summary>
public ESCCheckBox()
{
this.DefaultStyleKey = typeof(System.Windows.Controls.CheckBox);
}
}
Unfortunately, the snippet above causes the ESCCheckBox to use the default style of the System.Windows.Controls.CheckBox instead of the one defined in the Generic.xaml (Vista theme). Note that I can update the TargetType attribute on the CheckBox style in the Generic.xaml to something like TargetType="local:ESCCheckBox" and everything works great. But, doing this for all of our controls for multiple themes and making it all work is quite a task!
Any thoughts on how i could use the base control's style as-is from the Generic.xaml?
I've been tasked with setting up a Silverlight control set for our company's developers for use throughout multiple projects. Each control in this set will wrap either a Telerik or standard Silverlight control. For example, the control set will contain an ESCButton class which derives from System.Windows.Controls.Button, an ESCCheckBox class which derives from System.Windows.Controls.CheckBox, an ESCComboBox which derives from RadComboBox, etc - you get the idea...We're trying to take this approach in case a particular control needs some non-standard functionality that we can implement and all projects will be able to benefit with no additional effort. Make sense?
To make matters a little more interesting, these controls need to share a common 'theme' that will be customized at a later date... As a starting point, I took the Generic.xaml from the Telerik.Windows.Themes.Vista dll and placed it inside the assembly for our custom control set under a folder named Themes. My question is... Without modifying each Style's TargetType attribute in the massive Generic.xaml (which exceeds 20,000 lines), is there any way to link the style of the base controls (e.g. System.Windows.Controls.Button, System.Windows.Controls.CheckBox, RadComboBox) with our extended controls? Hopefully, the following snippet will help you understand what I am trying to accomplish:
public class ESCCheckBox : System.Windows.Controls.CheckBox
{
/// <summary>
/// Initializes a new instance of the ESCCheckBox class.
/// </summary>
public ESCCheckBox()
{
this.DefaultStyleKey = typeof(System.Windows.Controls.CheckBox);
}
}
Unfortunately, the snippet above causes the ESCCheckBox to use the default style of the System.Windows.Controls.CheckBox instead of the one defined in the Generic.xaml (Vista theme). Note that I can update the TargetType attribute on the CheckBox style in the Generic.xaml to something like TargetType="local:ESCCheckBox" and everything works great. But, doing this for all of our controls for multiple themes and making it all work is quite a task!
Any thoughts on how i could use the base control's style as-is from the Generic.xaml?