This is a migrated thread and some comments may be shown as answers.

Convert to NoXaml approach creates errors in my styles

1 Answer 46 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Iron
Veteran
Iron
Joe asked on 03 Apr 2019, 09:50 PM
I've been using the UI for WPF with the regular binaries and the StyleManager for a while.  Today I took a shot at switching to the NoXaml binaries.   Unfortunately my change has broken all of the custom styles I myself made for Telerik controls.  Specifically, the XAML parser blows up when it see me attempting to base my style on the default one like this:

<Style TargetType="{x:Type tk:RadRadioButton}"
   BasedOn="{StaticResource {x:Type tk:RadRadioButton}}">
    <Setter Property="CornerRadius" Value ="3"/>
</Style>


The "BasedOn" clause causes the problem.  I get the dreaded "Provide Value on StaticResourceHolder" error.  It would appear it cannot locate that default style for RadRadioButton on which I am trying to base my style.

Can you help me figure out further I need to do to make these styles work again?


I tried to follow the instructions here:

https://docs.telerik.com/devtools/WPF/styling-and-appearance/styling-apperance-setting-a-theme-overview

I removed all assembly references from the regular binaries and replaced them with references to the NoXaml equivalents.

Instead of copying the XAML files, I tried the approach that says to reference a theme from the /Binaries/NoXaml folder.

And since I am using the Windows8Touch, I m

https://docs.telerik.com/devtools/WPF/styling-and-appearance/themes-suite/common-styles-appearance-colorizing-metro-theme

And so I did this at the start of my application resources in App.xaml


<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <tk:Windows8ResourceDictionary/>
            <tk:Windows8TouchResourceDictionary/>



Am I missing something?

1 Answer, 1 is accepted

Sort by
0
Dinko
Telerik team
answered on 08 Apr 2019, 10:25 AM
Hi Joe,

Thank you for the code snippet.

Let me first start with that the name of the default style is created using the name of the control followed by a "Style" suffix. So in your case, the name of the default style of the RadRadioButton will be RadRadioButtonStyle. You can take a look at our Styling the Controls help article for further information.
<Style TargetType="{x:Type tk:RadRadioButton}" BasedOn="{StaticResource {x:Type tk:RadRadioButtonStyle}}">
    <Setter Property="CornerRadius" Value ="3"/>
</Style>

You can use this approach for all controls which you are using from our suite. Give it a try and let me know if you were able to run the project successfully.

Regards,
Dinko
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
General Discussions
Asked by
Joe
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Dinko
Telerik team
Share this question
or