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

Implicit Styles - Basing styles on theme style

3 Answers 251 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jens
Top achievements
Rank 1
Jens asked on 27 May 2015, 08:48 AM

Hey,

i just switched from StyleManager to implicit styles using this guide:
http://docs.telerik.com/devtools/silverlight/styling-and-appearance/styling-apperance-implicit-styles-overview

Using the styles from the theme dll provided in the NoXaml folder works fine.

1.<ResourceDictionary>
2.    <ResourceDictionary.MergedDictionaries>
3.        <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/System.Windows.xaml"/>
4.        <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.xaml"/>
5.        <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Navigation.xaml"/>
6.        <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Docking.xaml"/>               
7.    </ResourceDictionary.MergedDictionaries>
8.</ResourceDictionary>

But when trying to create a style based on an existing one

1.<Style x:Name="MyComboBox" TargetType="telerik:RadComboBox" BasedOn="{StaticResource RadComboBoxStyle}">
2.     
3.</Style>

The RadComboBoxStyle (or any other base style) cannot be found. When referencing the .xaml files from the Themes.Implicit folder everything works as expected 

1.<ResourceDictionary Source="Resources/Themes/Windows8/System.Windows.xaml"/>
2.<ResourceDictionary Source="Resources/Themes/Windows8/Telerik.Windows.Controls.xaml"/>
3.<ResourceDictionary Source="Resources/Themes/Windows8/Telerik.Windows.Controls.Docking.xaml"/>
4.<...>

Im just curious if this is the way things work. Without custom styles, use the .dll - if your want custom styles use the xaml files. But i dont see why referencing the .dll makes any difference. Can you explain this behaviour to me?

 Thanks & Cheers,

Jes

 

3 Answers, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 28 May 2015, 08:49 AM
Hello Jens,

There is no such limitations. It appears that the problem is related to the structure of your application's resources. Can you please provide us with more information or a sample project that can shed some light on this so we can be able to help you further?

Regards,
Sia
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jens
Top achievements
Rank 1
answered on 28 May 2015, 02:07 PM

It's a Silverlight 5 application and that's my whole App.xaml

01.<Application
02.    x:Class="Foo.SharePoint.Bar.Silverlight.App"
08.    markupCompatibility:Ignorable="d">
09.    <Application.Resources>
10. 
11.        <ResourceDictionary>
12.            <ResourceDictionary.MergedDictionaries>
13.                <ResourceDictionary Source="Resources/Themes/Windows8/System.Windows.xaml" />
14.                <ResourceDictionary Source="Resources/Themes/Windows8/Telerik.Windows.Controls.xaml" />
15.                <ResourceDictionary Source="Resources/Themes/Windows8/Telerik.Windows.Controls.Docking.xaml" />
16.                <ResourceDictionary Source="Resources/Themes/Windows8/Telerik.Windows.Controls.Input.xaml" />
17.                <ResourceDictionary Source="Resources/Themes/Windows8/Telerik.Windows.Controls.Navigation.xaml" />
18.                <ResourceDictionary Source="Resources/Themes/Windows8/Telerik.Windows.Documents.xaml" />
19. 
20.                <ResourceDictionary Source="Resources/Locator.xaml" />
21.                <ResourceDictionary Source="Resources/Styles.xaml" />
22.                <ResourceDictionary Source="Resources/Constants.xaml" />
23.                <ResourceDictionary Source="Resources/Converter.xaml" />
24.                <ResourceDictionary Source="Resources/Colors.xaml" />
25.                <ResourceDictionary Source="Resources/GenericListItem.xaml" />
26.                <ResourceDictionary Source="Resources/GenericInputs.xaml" />
27.                <ResourceDictionary Source="Resources/PropertyValue.xaml" />
28.                <ResourceDictionary Source="Resources/Notification.xaml" />
29.                <ResourceDictionary Source="Resources/Attachment.xaml" />
30. 
31.                <!-- for unknown reasons styles based on telerik styles, must be defined here and not in Styles.xaml -->
32.                <ResourceDictionary>
33.                    <Style
34.                        BasedOn="{StaticResource RadListBoxStyle}"
35.                        TargetType="telerik:RadListBox">
36.                        <Setter
37.                            Property="ScrollViewer.HorizontalScrollBarVisibility"
38.                            Value="Disabled" />
39.                        <Setter
40.                            Property="BorderThickness"
41.                            Value="0" />
42.                        <Setter
43.                            Property="FontFamily"
44.                            Value="{StaticResource DefaultFontFamily}" />
45.                    </Style>
46. 
47.                    <Style
48.                        BasedOn="{StaticResource RadButtonStyle}"
49.                        TargetType="telerik:RadButton">
50.                        <Setter
51.                            Property="FontFamily"
52.                            Value="{StaticResource DefaultFontFamily}" />
53.                        <Setter
54.                            Property="FontSize"
55.                            Value="{StaticResource MediumFontSize}" />
56.                    </Style>
57.                </ResourceDictionary>
58.            </ResourceDictionary.MergedDictionaries>
59.        </ResourceDictionary>
60.    </Application.Resources>
61.</Application>

All .xaml files are set to Build Action - Resource.

Thanks for having a look!

 

0
Accepted
Sia
Telerik team
answered on 02 Jun 2015, 12:24 PM
Hello again,

In order to make this work, you need to merge the needed telerik resource dictionary in Styles.xaml.
<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</ResourceDictionary.MergedDictionaries>

You can check the attached project. Please also note that the order of merging the resource dictionaries in App.xaml is important. You can follow our recommendations described in our help.

Regards,
Sia
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Jens
Top achievements
Rank 1
Answers by
Sia
Telerik team
Jens
Top achievements
Rank 1
Share this question
or