ControlTemplate.Trigger on StyleManager.Theme

2 posts, 0 answers
  1. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 02 Oct 2012 Link to this post

    I'm trying to avoid a lot of custom work with themes because all I want to do is change the Header BorderBrush used on various controls.  I was hoping I could do this as in the following snippet from a RadCalendar Style in my ResourceDictionary...

    <ControlTemplate TargetType="{x:Type telerik:RadCalendar}">
        <Grid>
            <!-- Standard RadCalendar Suff Omitted for brevity -->
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="telerik:StyleManager.Theme"
                     Value="telerik:Office_Black">
                <Setter TargetName="Navigation"
                        Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush EndPoint="0.5,1"
                                             StartPoint="0.5,0">
                            <GradientStop Color="#FF5B5B5B"
                                          Offset="1" />
                            <GradientStop Color="#FF868686" />
                            <GradientStop Color="#FF0E0E0E"
                                          Offset="0.449" />
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="telerik:StyleManager.Theme"
                     Value="telerik:Office_Blue">
                <Setter TargetName="Navigation"
                        Property="Background"
                        Value="Blue">
                </Setter>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    And then in my xaml...

    <telerik:RadDatePicker Width="300" telerik:StyleManager.Theme="{Binding TelerikTheme}" CalendarStyle="{StaticResource RadCalendarStyle1}"/>

    However it doesn't work.  Is there anyway to implement something along these lines?

    Thanks in advance,
    Steve








  2. Masha
    Admin
    Masha avatar
    355 posts

    Posted 08 Oct 2012 Link to this post

    Hi Steve,

    We recommend using Implicit Styles when styling our controls - they allow to customize certain parts of the templates more easily.  Please find attached a sample project which illustrates how to achieve the needed approach with implicit styles

    If this does not help, send us a simple runnable project which demonstrates exactly the scenario. You should open a support ticket and attach the project there.

    Greetings,
    Maria
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top