Implicit Styles - Basing styles on theme style

4 posts, 1 answers
  1. Jens
    Jens avatar
    19 posts
    Member since:
    Aug 2014

    Posted 27 May 2015 Link to this post


    i just switched from StyleManager to implicit styles using this guide:

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

    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>

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

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

    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"/>

    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,



  2. Sia
    Sia avatar
    685 posts

    Posted 28 May 2015 Link to this post

    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?

    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
  3. Jens
    Jens avatar
    19 posts
    Member since:
    Aug 2014

    Posted 28 May 2015 in reply to Sia Link to this post

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

    02.    x:Class="Foo.SharePoint.Bar.Silverlight.App"
    08.    markupCompatibility:Ignorable="d">
    09.    <Application.Resources>
    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" />
    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" />
    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>
    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>

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

    Thanks for having a look!


  4. Answer
    Sia avatar
    685 posts

    Posted 02 Jun 2015 Link to this post

    Hello again,

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

    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.

    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
Back to Top