It is gone… Merged in Telerik.Windows.Controls.Input.xaml. But you can still extract it, just read on.

A while ago we have released the styles for all our controls and themes of the RadControls for Silverlight and WPF suites as ResourceDictionary xaml files containing implicit styles. Currently they could be merged in the App.xaml files of your application and would apply globally. Of course there is more information available in the help sections:

Some of the benefits are that the styles are no longer hidden in a dll’s resources but rather exposed in your application. And so it is easier to re-style some of the controls or base your styles on the theme’s styles. Working with a .xaml file should be no brainer for any WPF or Silverlight developer and the cost difference between managing a dll reference and a xaml file (in case it is not modified) should be minimal.

One of the downsides though in the implementation of the implicit styles was that we had to create a xaml file per control assembly. We decided to do so to reduce the overhead of duplication of resources such as Brushes, as well as decreased count of merged dictionaries required in your App.xaml. With the increasing count of our controls some of these xaml files got a little bigger. Should you work with 3000 lines of xaml to edit a control that is small part of it? What if you do not use all controls there and want to remove some of the extra xaml?

So we get to the problem - “I want my ComboBox.xaml file”

How do you extract the RadComboBox’s Style from the Telerik.Windows.Control.Input.xaml? You could go there find the Style with TargetType of RadComboBox and copy that in a separate ResourceDictionary. Then you find it has some StaticResource references and copy these resources in the dictionary too. One of the resources was a ControlTemplate that had further StaticResources. Eventually when you do that recursively two or three times you would give up.

With the XAML being an XML however it is incredibly easy to automate that task.

The attached tool can do the job. Run the project then click “Open”. Navigate to “C:\Program Files (x86)\Telerik\RadControls for Silverlight Q1 2012 SP1\Themes.Implicit\OfficeSilver\Themes” (note the version and location could vary) and open the “Telerik.Windows.Controls.Input.xaml” file. You should get a screen such as:

All resources from that file would be listed in the left hand area. You can select some of the resources there and a ResourceDictionary would be generated with the selection to the right. Note you could multi-select holding the Ctrl key, Ctrl + All should work too. Click the drop down stating “Show All” and switch to “Implicit Style”. The list will be filtered. Now Select:

  • Style: {x:Type telerikInput:RadComboBox}
  • Style: {x:Type telerikInput:RadComboBoxItem}

You will see in the right pane that all selected resources including recursive StaticResources were merged:

You could either select and copy-paste the resources from the ResourceDictionary, click “Save” to export the file in a new xaml file or append the contents to existing dictionary. “Append To…” will try to merge the left hand selection but it may need to override some resources or rename namespaces. It is not tested, it may have difficulties with markup extensions. So consider checking in or backups before modifying files.

You just have to “Save” as “ComboBox.xaml” now.

Panayot Cankov 164x164
About the Author

Panayot Cankov

Panayot Cankov has 15 years of experience focused on UI. He has spent 9 years at Progress working on the XAML stack and the NativeScript framework. Today he is pushing forward AR/VR technologies as he is a big believer in them, along with AI/ML for being the foundation of the next generation line of business application experiences.

Related Posts


Comments are disabled in preview mode.