customTemplates and change's theme

13 posts, 0 answers
  1. Luis
    Luis avatar
    29 posts
    Member since:
    Dec 2013

    Posted 22 Sep 2014 Link to this post

    hi, I need change the theme of the control with custom template.
    I changed the theme of my silverlight app and some controls(custom Template) remain with the same theme.
    what can I  do for change the theme of these controls to be the equals of others?

    example:
    customCombobox, radwindow, expander >> theme default win7
    changed theme
    cusmtomCombobox >> win7 --  radwindow, expander >> win8 theme

    I'm use blend for edit a copy of current theme.

    PD. in the image can see I have three combobox, two of them with different theme

    thankss...
    have a nice day.
  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 22 Sep 2014 Link to this post

    Hello Luis,


    Thank you for contacting us.

    In our online documentation you will find an article, which demonstrates how to switch themes at runtime, here.
     

    Since the templates are isolated in separate resource dictionaries you could add and clear those you need within ComboBox's SelectionChanged event handler. 

    Can you please take a look at the resource above and let me know how it corresponds to your needs?


    Regards,
    Vanya Pavlova
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. DevCraft banner
  4. Luis
    Luis avatar
    29 posts
    Member since:
    Dec 2013

    Posted 22 Sep 2014 in reply to Vanya Pavlova Link to this post

    I dont have problem to change the theme in runtime.
    the goal is change the controls with custom template, that controls don't change.
    I use a copy of current template and modified the template, but saved the theme of that moment.

    how change the theme of custom template control?
  5. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 23 Sep 2014 Link to this post

    Hi Luis,


    Thank you for getting back to us.

    What type of assemblies you are currently using - standard or NoXAML ones?

    Regards,
    Vanya Pavlova
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. Luis
    Luis avatar
    29 posts
    Member since:
    Dec 2013

    Posted 23 Sep 2014 in reply to Vanya Pavlova Link to this post

    standard 
  7. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 23 Sep 2014 Link to this post

    Hello Luis,


    Thank you for getting back to us.

    Predefining the template of custom controls is not supported with standard assemblies.
    If you use NoXAML binaries combined with implicit styles, you could achieve your goal. 

    Provide the DefaultStyleKey for the element, some template and switch it in the same way as proposed in our documentation.
     

    Regards,
    Vanya Pavlova
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  8. Luis
    Luis avatar
    29 posts
    Member since:
    Dec 2013

    Posted 23 Sep 2014 in reply to Vanya Pavlova Link to this post

    001.<SolidColorBrush x:Key="ControlForeground_Normal" Color="#FF000000" />
    002.<SolidColorBrush x:Key="Expander_Background" Color="#00FFFFFF" />
    003.<SolidColorBrush x:Key="Expander_BorderBrush" Color="#00FFFFFF" />
    004.<Thickness x:Key="Expander_BorderThickness">0</Thickness>
    005.<LinearGradientBrush x:Key="ControlBackground_Normal" EndPoint="0.5,1" StartPoint="0.5,0">
    006.    <GradientStop Color="#FFFFFFFF" Offset="0" />
    007.    <GradientStop Color="#FFDCDCDC" Offset="0.50" />
    008.    <GradientStop Color="#FFADADAD" Offset="0.50" />
    009.    <GradientStop Color="#FFD4D4D4" Offset="1" />
    010.</LinearGradientBrush>
    011.<SolidColorBrush x:Key="ControlOuterBorder_Normal" Color="#FF848484" />
    012.<SolidColorBrush x:Key="ControlInnerBorder_Normal" Color="#FFFFFFFF" />
    013.<SolidColorBrush x:Key="ControlElement_Normal" Color="#FF000000" />
    014.<ControlTemplate x:Key="ToggleTemplate" TargetType="telerik:RadToggleButton">
    015.    <ContentPresenter x:Name="Content" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
    016.</ControlTemplate>
    017.<CornerRadius x:Key="Expander_BorderRadius">3</CornerRadius>
    018.<SolidColorBrush x:Key="ControlOuterBorder_Disabled" Color="#FF989898" />
    019.<SolidColorBrush x:Key="ControlBackground_Disabled" Color="#FFE0E0E0" />
    020.<SolidColorBrush x:Key="ControlElement_Disabled" Color="#FF8D8D8D" />
    021.<SolidColorBrush x:Key="ControlInnerBorder_Disabled" Color="Transparent" />
    022.<SolidColorBrush x:Key="ControlOuterBorder_MouseOver" Color="#FFFFC92B" />
    023.<LinearGradientBrush x:Key="ControlBackground_MouseOver" EndPoint="0.5,1" StartPoint="0.5,0">
    024.    <GradientStop Color="#FFFFFBDA" Offset="0" />
    025.    <GradientStop Color="#FFFEEBAE" Offset="0.50" />
    026.    <GradientStop Color="#FFFFD25A" Offset="0.50" />
    027.    <GradientStop Color="#FFFFFBA3" Offset="1" />
    028.</LinearGradientBrush>
    029.<SolidColorBrush x:Key="ControlElement_MouseOver" Color="#FF000000" />
    030.<SolidColorBrush x:Key="ControlInnerBorder_MouseOver" Color="#FFFFFFFF" />
    031.<LinearGradientBrush x:Key="ControlBackground_Pressed" EndPoint="0.5,1" StartPoint="0.5,0">
    032.    <GradientStop Color="#FFFFDCAB" Offset="0" />
    033.    <GradientStop Color="#FFFFD18F" Offset="0.5" />
    034.    <GradientStop Color="#FFFE9227" Offset="0.5" />
    035.    <GradientStop Color="#FFFFBA74" Offset="0" />
    036.</LinearGradientBrush>
    037.<LinearGradientBrush x:Key="ControlOuterBorder_Pressed" EndPoint="0.5,1" StartPoint="0.5,0">
    038.    <GradientStop Color="#FF282828" />
    039.    <GradientStop Color="#FF5F5F5F" Offset="1" />
    040.</LinearGradientBrush>
    041.<SolidColorBrush x:Key="ControlElement_Pressed" Color="#FF000000" />
    042.<LinearGradientBrush x:Key="ControlInnerBorder_Pressed" EndPoint="0.5,1" StartPoint="0.5,0">
    043.    <GradientStop Color="#FFB69A78" />
    044.    <GradientStop Color="#FFFFE17A" Offset="0.126" />
    045.</LinearGradientBrush>
    046.<ControlTemplate x:Key="ExpanderTemplate" TargetType="telerik:RadExpander">
    047.    <Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
    048.        <VisualStateManager.VisualStateGroups>
    049.            <VisualStateGroup x:Name="CommonStateGroup">
    050.                <VisualState x:Name="Normal" />
    051.                <VisualState x:Name="Disabled">
    052.                    <Storyboard>
    053.                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="Stroke" Storyboard.TargetName="OuterCircle">
    054.                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlOuterBorder_Disabled}" />
    055.                        </ObjectAnimationUsingKeyFrames>
    056.                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="Fill" Storyboard.TargetName="OuterCircle">
    057.                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlBackground_Disabled}" />
    058.                        </ObjectAnimationUsingKeyFrames>
    059.                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Fill" Storyboard.TargetName="arrow">
    060.                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ControlElement_Disabled}" />
    061.                        </ObjectAnimationUsingKeyFrames>
    062.                        <DoubleAnimation Duration="0" To=".5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HeaderContent" />
    063.                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="Stroke" Storyboard.TargetName="InnerCircle">
    064.                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlInnerBorder_Disabled}" />
    065.                        </ObjectAnimationUsingKeyFrames>
    066.                    </Storyboard>
    067.                </VisualState>
    068.            </VisualStateGroup>
    069.            <VisualStateGroup x:Name="HeaderStateGroup">
    070.                <VisualState x:Name="NormalHeader" />
    071.                <VisualState x:Name="MouseOverHeader">
    072.                    <Storyboard>
    073.                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="NormalCircle" />
    074.                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="Stroke" Storyboard.TargetName="OuterCircle">
    075.                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlOuterBorder_MouseOver}" />
    076.                        </ObjectAnimationUsingKeyFrames>
    077.                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="Fill" Storyboard.TargetName="OuterCircle">
    078.                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlBackground_MouseOver}" />
    079.                        </ObjectAnimationUsingKeyFrames>
    080.                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Fill" Storyboard.TargetName="arrow">
    081.                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ControlElement_MouseOver}" />
    082.                        </ObjectAnimationUsingKeyFrames>
    083.                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="Stroke" Storyboard.TargetName="InnerCircle">
    084.                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlInnerBorder_MouseOver}" />
    085.                        </ObjectAnimationUsingKeyFrames>
    086.                    </Storyboard>
    087.                </VisualState>
    088.                <VisualState x:Name="PressedHeader">
    089.                    <Storyboard>
    090.                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="NormalCircle" />
    091.                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="Fill" Storyboard.TargetName="OuterCircle">
    092.                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlBackground_Pressed}" />
    093.                        </ObjectAnimationUsingKeyFrames>
    094.                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="Stroke" Storyboard.TargetName="OuterCircle">
    095.                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlOuterBorder_Pressed}" />
    096.                        </ObjectAnimationUsingKeyFrames>
    097.                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Fill" Storyboard.TargetName="arrow">
    098.                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ControlElement_Pressed}" />
    099.                        </ObjectAnimationUsingKeyFrames>
    100.                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="Stroke" Storyboard.TargetName="InnerCircle">
    101.                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlInnerBorder_Pressed}" />
    102.                        </ObjectAnimationUsingKeyFrames>
    103.                    </Storyboard>
    104.                </VisualState>
    105.            </VisualStateGroup>
    106.            <VisualStateGroup x:Name="HeaderOrientationGroup">
    107.                <VisualState x:Name="HorizontalOrientation">
    108.                    <Storyboard>
    109.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="LayoutTransform" Storyboard.TargetName="HeaderContentTransform">
    110.                            <DiscreteObjectKeyFrame KeyTime="0">
    111.                                <DiscreteObjectKeyFrame.Value>
    112.                                    <RotateTransform Angle="0" />
    113.                                </DiscreteObjectKeyFrame.Value>
    114.                            </DiscreteObjectKeyFrame>
    115.                        </ObjectAnimationUsingKeyFrames>
    116.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.Column)" Storyboard.TargetName="HeaderContentTransform">
    117.                            <DiscreteObjectKeyFrame KeyTime="0">
    118.                                <DiscreteObjectKeyFrame.Value>
    119.                                    <System:Int32>1</System:Int32>
    120.                                </DiscreteObjectKeyFrame.Value>
    121.                            </DiscreteObjectKeyFrame>
    122.                        </ObjectAnimationUsingKeyFrames>
    123.                    </Storyboard>
    124.                </VisualState>
    125.                <VisualState x:Name="VerticalOrientation">
    126.                    <Storyboard>
    127.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="LayoutTransform" Storyboard.TargetName="HeaderContentTransform">
    128.                            <DiscreteObjectKeyFrame KeyTime="0">
    129.                                <DiscreteObjectKeyFrame.Value>
    130.                                    <RotateTransform Angle="90" />
    131.                                </DiscreteObjectKeyFrame.Value>
    132.                            </DiscreteObjectKeyFrame>
    133.                        </ObjectAnimationUsingKeyFrames>
    134.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.Row)" Storyboard.TargetName="HeaderContentTransform">
    135.                            <DiscreteObjectKeyFrame KeyTime="0">
    136.                                <DiscreteObjectKeyFrame.Value>
    137.                                    <System:Int32>1</System:Int32>
    138.                                </DiscreteObjectKeyFrame.Value>
    139.                            </DiscreteObjectKeyFrame>
    140.                        </ObjectAnimationUsingKeyFrames>
    141.                    </Storyboard>
    142.                </VisualState>
    143.            </VisualStateGroup>
    144.            <VisualStateGroup x:Name="ExpandStateGroup">
    145.                <VisualState x:Name="Expanded">
    146.                    <Storyboard>
    147.                        <DoubleAnimation Duration="0:0:0.2" To="180" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)" Storyboard.TargetName="arrow" />
    148.                    </Storyboard>
    149.                </VisualState>
    150.                <VisualState x:Name="Collapsed">
    151.                    <Storyboard>
    152.                        <DoubleAnimation Duration="0:0:0.2" To="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)" Storyboard.TargetName="arrow" />
    153.                    </Storyboard>
    154.                </VisualState>
    155.            </VisualStateGroup>
    156.            <VisualStateGroup x:Name="ExpandDirectionStates">
    157.                <VisualStateGroup.Transitions>
    158.                    <VisualTransition>
    159.                        <Storyboard>
    160.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.Row)" Storyboard.TargetName="Content">
    161.                                <DiscreteObjectKeyFrame KeyTime="0">
    162.                                    <DiscreteObjectKeyFrame.Value>
    163.                                        <System:Int32>0</System:Int32>
    164.                                    </DiscreteObjectKeyFrame.Value>
    165.                                </DiscreteObjectKeyFrame>
    166.                            </ObjectAnimationUsingKeyFrames>
    167.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.Column)" Storyboard.TargetName="Content">
    168.                                <DiscreteObjectKeyFrame KeyTime="0">
    169.                                    <DiscreteObjectKeyFrame.Value>
    170.                                        <System:Int32>0</System:Int32>
    171.                                    </DiscreteObjectKeyFrame.Value>
    172.                                </DiscreteObjectKeyFrame>
    173.                            </ObjectAnimationUsingKeyFrames>
    174.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.Row)" Storyboard.TargetName="HeaderButton">
    175.                                <DiscreteObjectKeyFrame KeyTime="0">
    176.                                    <DiscreteObjectKeyFrame.Value>
    177.                                        <System:Int32>0</System:Int32>
    178.                                    </DiscreteObjectKeyFrame.Value>
    179.                                </DiscreteObjectKeyFrame>
    180.                            </ObjectAnimationUsingKeyFrames>
    181.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.Column)" Storyboard.TargetName="HeaderButton">
    182.                                <DiscreteObjectKeyFrame KeyTime="0">
    183.                                    <DiscreteObjectKeyFrame.Value>
    184.                                        <System:Int32>0</System:Int32>
    185.                                    </DiscreteObjectKeyFrame.Value>
    186.                                </DiscreteObjectKeyFrame>
    187.                            </ObjectAnimationUsingKeyFrames>
    188.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Width" Storyboard.TargetName="col0">
    189.                                <DiscreteObjectKeyFrame KeyTime="0">
    190.                                    <DiscreteObjectKeyFrame.Value>
    191.                                        <GridLength>Auto</GridLength>
    192.                                    </DiscreteObjectKeyFrame.Value>
    193.                                </DiscreteObjectKeyFrame>
    194.                            </ObjectAnimationUsingKeyFrames>
    195.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Width" Storyboard.TargetName="col1">
    196.                                <DiscreteObjectKeyFrame KeyTime="0">
    197.                                    <DiscreteObjectKeyFrame.Value>
    198.                                        <GridLength>Auto</GridLength>
    199.                                    </DiscreteObjectKeyFrame.Value>
    200.                                </DiscreteObjectKeyFrame>
    201.                            </ObjectAnimationUsingKeyFrames>
    202.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Height" Storyboard.TargetName="row0">
    203.                                <DiscreteObjectKeyFrame KeyTime="0">
    204.                                    <DiscreteObjectKeyFrame.Value>
    205.                                        <GridLength>Auto</GridLength>
    206.                                    </DiscreteObjectKeyFrame.Value>
    207.                                </DiscreteObjectKeyFrame>
    208.                            </ObjectAnimationUsingKeyFrames>
    209.                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Height" Storyboard.TargetName="row1">
    210.                                <DiscreteObjectKeyFrame KeyTime="0">
    211.                                    <DiscreteObjectKeyFrame.Value>
    212.                                        <GridLength>Auto</GridLength>
    213.                                    </DiscreteObjectKeyFrame.Value>
    214.                                </DiscreteObjectKeyFrame>
    215.                            </ObjectAnimationUsingKeyFrames>
    216.                        </Storyboard>
    217.                    </VisualTransition>
    218.                </VisualStateGroup.Transitions>
    219.                <VisualState x:Name="DirectionLeft">
    220.                    <Storyboard>
    221.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Width" Storyboard.TargetName="col0">
    222.                            <DiscreteObjectKeyFrame KeyTime="0">
    223.                                <DiscreteObjectKeyFrame.Value>
    224.                                    <GridLength>*</GridLength>
    225.                                </DiscreteObjectKeyFrame.Value>
    226.                            </DiscreteObjectKeyFrame>
    227.                        </ObjectAnimationUsingKeyFrames>
    228.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Height" Storyboard.TargetName="row0">
    229.                            <DiscreteObjectKeyFrame KeyTime="0">
    230.                                <DiscreteObjectKeyFrame.Value>
    231.                                    <GridLength>*</GridLength>
    232.                                </DiscreteObjectKeyFrame.Value>
    233.                            </DiscreteObjectKeyFrame>
    234.                        </ObjectAnimationUsingKeyFrames>
    235.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.Column)" Storyboard.TargetName="HeaderButton">
    236.                            <DiscreteObjectKeyFrame KeyTime="0">
    237.                                <DiscreteObjectKeyFrame.Value>
    238.                                    <System:Int32>1</System:Int32>
    239.                                </DiscreteObjectKeyFrame.Value>
    240.                            </DiscreteObjectKeyFrame>
    241.                        </ObjectAnimationUsingKeyFrames>
    242.                        <DoubleAnimation Duration="0:0:0" To="90" Storyboard.TargetProperty="(FrameworkElement.RenderTransform).Angle" Storyboard.TargetName="arrowPanel" />
    243.                    </Storyboard>
    244.                </VisualState>
    245.                <VisualState x:Name="DirectionRight">
    246.                    <Storyboard>
    247.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Width" Storyboard.TargetName="col1">
    248.                            <DiscreteObjectKeyFrame KeyTime="0">
    249.                                <DiscreteObjectKeyFrame.Value>
    250.                                    <GridLength>*</GridLength>
    251.                                </DiscreteObjectKeyFrame.Value>
    252.                            </DiscreteObjectKeyFrame>
    253.                        </ObjectAnimationUsingKeyFrames>
    254.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Height" Storyboard.TargetName="row0">
    255.                            <DiscreteObjectKeyFrame KeyTime="0">
    256.                                <DiscreteObjectKeyFrame.Value>
    257.                                    <GridLength>*</GridLength>
    258.                                </DiscreteObjectKeyFrame.Value>
    259.                            </DiscreteObjectKeyFrame>
    260.                        </ObjectAnimationUsingKeyFrames>
    261.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.Column)" Storyboard.TargetName="Content">
    262.                            <DiscreteObjectKeyFrame KeyTime="0">
    263.                                <DiscreteObjectKeyFrame.Value>
    264.                                    <System:Int32>1</System:Int32>
    265.                                </DiscreteObjectKeyFrame.Value>
    266.                            </DiscreteObjectKeyFrame>
    267.                        </ObjectAnimationUsingKeyFrames>
    268.                        <DoubleAnimation Duration="0:0:0" To="-90" Storyboard.TargetProperty="(FrameworkElement.RenderTransform).Angle" Storyboard.TargetName="arrowPanel" />
    269.                    </Storyboard>
    270.                </VisualState>
    271.                <VisualState x:Name="DirectionUp">
    272.                    <Storyboard>
    273.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Width" Storyboard.TargetName="col0">
    274.                            <DiscreteObjectKeyFrame KeyTime="0">
    275.                                <DiscreteObjectKeyFrame.Value>
    276.                                    <GridLength>*</GridLength>
    277.                                </DiscreteObjectKeyFrame.Value>
    278.                            </DiscreteObjectKeyFrame>
    279.                        </ObjectAnimationUsingKeyFrames>
    280.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Height" Storyboard.TargetName="row0">
    281.                            <DiscreteObjectKeyFrame KeyTime="0">
    282.                                <DiscreteObjectKeyFrame.Value>
    283.                                    <GridLength>*</GridLength>
    284.                                </DiscreteObjectKeyFrame.Value>
    285.                            </DiscreteObjectKeyFrame>
    286.                        </ObjectAnimationUsingKeyFrames>
    287.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.Row)" Storyboard.TargetName="HeaderButton">
    288.                            <DiscreteObjectKeyFrame KeyTime="0">
    289.                                <DiscreteObjectKeyFrame.Value>
    290.                                    <System:Int32>1</System:Int32>
    291.                                </DiscreteObjectKeyFrame.Value>
    292.                            </DiscreteObjectKeyFrame>
    293.                        </ObjectAnimationUsingKeyFrames>
    294.                        <DoubleAnimation Duration="0:0:0" To="180" Storyboard.TargetProperty="(FrameworkElement.RenderTransform).Angle" Storyboard.TargetName="arrowPanel" />
    295.                    </Storyboard>
    296.                </VisualState>
    297.                <VisualState x:Name="DirectionDown">
    298.                    <Storyboard>
    299.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Width" Storyboard.TargetName="col0">
    300.                            <DiscreteObjectKeyFrame KeyTime="0">
    301.                                <DiscreteObjectKeyFrame.Value>
    302.                                    <GridLength>*</GridLength>
    303.                                </DiscreteObjectKeyFrame.Value>
    304.                            </DiscreteObjectKeyFrame>
    305.                        </ObjectAnimationUsingKeyFrames>
    306.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Height" Storyboard.TargetName="row1">
    307.                            <DiscreteObjectKeyFrame KeyTime="0">
    308.                                <DiscreteObjectKeyFrame.Value>
    309.                                    <GridLength>*</GridLength>
    310.                                </DiscreteObjectKeyFrame.Value>
    311.                            </DiscreteObjectKeyFrame>
    312.                        </ObjectAnimationUsingKeyFrames>
    313.                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Grid.Row)" Storyboard.TargetName="Content">
    314.                            <DiscreteObjectKeyFrame KeyTime="0">
    315.                                <DiscreteObjectKeyFrame.Value>
    316.                                    <System:Int32>1</System:Int32>
    317.                                </DiscreteObjectKeyFrame.Value>
    318.                            </DiscreteObjectKeyFrame>
    319.                        </ObjectAnimationUsingKeyFrames>
    320.                    </Storyboard>
    321.                </VisualState>
    322.            </VisualStateGroup>
    323.        </VisualStateManager.VisualStateGroups>
    324.        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{StaticResource Expander_BorderRadius}">
    325.            <Grid >
    326.                <Grid.ColumnDefinitions>
    327.                    <ColumnDefinition x:Name="col0" Width="Auto" />
    328.                    <ColumnDefinition x:Name="col1" Width="Auto" />
    329.                </Grid.ColumnDefinitions>
    330.                <Grid.RowDefinitions>
    331.                    <RowDefinition x:Name="row0" Height="Auto" />
    332.                    <RowDefinition x:Name="row1" Height="Auto" />
    333.                </Grid.RowDefinitions>
    334. 
    335.                <telerik:RadToggleButton x:Name="HeaderButton" Background="Transparent" ClickMode="{TemplateBinding ClickMode}" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}"
    336.                                                 FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}"
    337.                                                 HorizontalAlignment="{TemplateBinding HorizontalHeaderAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalHeaderAlignment}"
    338.                                                 IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" TabIndex="{TemplateBinding TabIndex}"
    339.                                                 Template="{StaticResource ToggleTemplate}" VerticalAlignment="{TemplateBinding VerticalHeaderAlignment}" VerticalContentAlignment="{TemplateBinding VerticalHeaderAlignment}">
    340. 
    341.                    <Grid>
    342.                        <Grid.ColumnDefinitions>
    343.                            <ColumnDefinition Width="Auto" />
    344.                            <ColumnDefinition Width="*" />
    345.                        </Grid.ColumnDefinitions>
    346.                        <telerik:RadButton Grid.Column="0" Width="20" Height="20" VerticalAlignment="Top" x:Name="cmdMax">
    347.                            <Grid  RenderTransformOrigin="0.5 0.5">
    348.                                <Grid.RenderTransform>
    349.                                    <RotateTransform />
    350.                                </Grid.RenderTransform>
    351.                                <Path Fill="Black" Data="M0,0 L0,0 L0,0 L0,0 L35.0001,0 L35.0001,35 L0,35 L0,0 z" RenderTransformOrigin="0.5,0.5" Stretch="Fill" UseLayoutRounding="False" HorizontalAlignment="Right" Width="10" Height="10">
    352.                                    <Path.RenderTransform>
    353.                                        <TransformGroup>
    354.                                            <RotateTransform Angle="0" />
    355.                                            <TranslateTransform />
    356.                                        </TransformGroup>
    357.                                    </Path.RenderTransform>
    358.                                </Path>
    359.                            </Grid>
    360.                        </telerik:RadButton>
    361.                        <Grid x:Name="HeaderPanel" Background="Transparent" Grid.Column="1">
    362.                            <Grid.ColumnDefinitions>
    363.                                <ColumnDefinition Width="Auto" />
    364.                                <ColumnDefinition Width="Auto" />
    365.                                <ColumnDefinition Width="*" />
    366.                            </Grid.ColumnDefinitions>
    367.                            <Grid.RowDefinitions>
    368.                                <RowDefinition Height="Auto" />
    369.                                <RowDefinition Height="*" />
    370.                            </Grid.RowDefinitions>
    371.                             
    372.                            <Grid Grid.Column="2" HorizontalAlignment="Right">
    373.                                <Ellipse x:Name="NormalCircle" Fill="{StaticResource ControlBackground_Normal}" HorizontalAlignment="Center" Height="20" Stroke="{StaticResource ControlOuterBorder_Normal}" StrokeThickness="1" VerticalAlignment="Center" Width="20" />
    374.                                <Ellipse x:Name="OuterCircle" Fill="{x:Null}" HorizontalAlignment="Center" Height="20" Stroke="{x:Null}" StrokeThickness="1" VerticalAlignment="Center" Width="20" />
    375.                                <Ellipse x:Name="InnerCircle" HorizontalAlignment="Center" Height="18" Stroke="{StaticResource ControlInnerBorder_Normal}" VerticalAlignment="Center" Width="18" />
    376.                                <Grid x:Name="arrowPanel" RenderTransformOrigin="0.5 0.5">
    377.                                    <Grid.RenderTransform>
    378.                                        <RotateTransform />
    379.                                    </Grid.RenderTransform>
    380.                                    <Path x:Name="arrow" Data="M0,0 L0.67,0 4,2.67 7.25,0 8,0 8,0.67 4,4 0,0.75 z" Fill="{StaticResource ControlElement_Normal}" Height="4" RenderTransformOrigin="0.5,0.5" Stretch="None" Width="8">
    381.                                        <Path.RenderTransform>
    382.                                            <TransformGroup>
    383.                                                <RotateTransform Angle="0" />
    384.                                                <TranslateTransform />
    385.                                            </TransformGroup>
    386.                                        </Path.RenderTransform>
    387.                                    </Path>
    388.                                </Grid>
    389.                            </Grid>
    390.                            <telerikPrimitives:LayoutTransformControl x:Name="HeaderContentTransform" RenderTransformOrigin=".5 .5" Grid.Column="1">
    391.                                <ContentPresenter x:Name="HeaderContent" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Grid.Column="1" HorizontalAlignment="Stretch" Margin="5 0" UseLayoutRounding="True" VerticalAlignment="Center" />
    392.                            </telerikPrimitives:LayoutTransformControl>
    393.                        </Grid>
    394.                    </Grid>
    395.                </telerik:RadToggleButton>
    396.                <ContentPresenter x:Name="Content" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" UseLayoutRounding="True" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
    397.            </Grid>
    398.        </Border>
    399.    </Grid>
    400.</ControlTemplate>
    401. 
    402.<Style x:Key="RadExpanderStyle" TargetType="telerik:RadExpander"/>
    403. 
    404.<Style x:Key="RadExpanderCustom" TargetType="telerik:RadExpander" BasedOn="{StaticResource RadExpanderStyle}" >
    405.    <Setter Property="Template" Value="{StaticResource ExpanderTemplate}" />
    406.</Style>
     
    in the line 346 I add a radbutton in the header of radexpander.
    when i change the global themes, this control don't change it... 
    I have to do for change the theme of control together with app?

    the button's theme change but expander not

    if I modify the noXAML control's template, will occur the same thing?
    x...x
  9. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 26 Sep 2014 Link to this post

    Hi Luis,

    Please mind that our implicit styles theme mechanism works with our default control templates. You may modify the implicit styles setters for every control but as soon as you have custom control template, you will lose the theming. This is expected as the control templates holds practically everything - the Visual States and the Visual Structure of the control which are theme specific.
    There are two approaches you might choose from in your case:
    1. Have a separate control template per every theme you have and merge it after our style files resource dictionaries. For the purpose just modify the default RadExpander template that we provide. Do not forget to clean the merged dictionaries and add the custom control templates back every time you switch theme. Let me know if you need further explanation or assistance with this approach. I highly reccomend this approach.

    2. You might keep a single control template for every theme you have. However you'll need to apply a predefined theme-based RadExpander brushes everytime you change theme (for example on button click).
    For the purpose you might use the following approach:
    - create a Brush property with predefined value per each theme you have and listen for property changed:

    private Brush headerAccentBrush;
     
    public Brush HeaderAccentBrush
    {
        get { return headerAccentBrush; }
        set { headerAccentBrush = value; this.NotifyPropertyChanged("HeaderAccentBrush"); }
    }

    - traverse the viusal tree to find the HeaderPanel of radExpander. For example:

    var grid = this.ColorRadExpander.ChildrenOfType<Grid>().FirstOrDefault(g => g.Name == "HeaderPanel");

    if (grid != null)
    {
    grid.Background = new SolidColorBrush(Windows8Palette.Palette.AccentColor);
    }

    - now apply the new Brush to the Expander Header/Content:

    var binding = new Binding("HeaderAccentBrush");
    binding.Source = this.ColorRadExpander.Content;
    grid.SetBinding(Grid.BackgroundProperty, binding);

    It will be very helpful if you are sending us runnable samples rather than code snippets so that we can inspect them and get back to you with faster responses.

    Regards,
    Evgenia
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  10. Luis
    Luis avatar
    29 posts
    Member since:
    Dec 2013

    Posted 30 Sep 2014 in reply to Evgenia Link to this post

    thanks, I will see what I do. 
  11. Luis
    Luis avatar
    29 posts
    Member since:
    Dec 2013

    Posted 07 Oct 2014 Link to this post

    hi, I changed my Implementation of the controls about the static template.
    I have an inherited class from radcombobox but when I change the app's theme,  the radcombobox doesn't change
    I put a style base on radcombobox but nothing....

    some idea?
    thanks have a nice day


    public
    class ComboExport : RadComboBox
    {
        public ComboExport()
            {
     
                this.style = app.resources["style"] as Style;
                 
            }
    }
  12. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 10 Oct 2014 Link to this post

    Hi Luis,

    The reason for this is that you have to merge the custom style every time you switch theme. For the purpose I suggest that you create new resource dictionary and add the custom style in it. You might find a sample project where this is demonstrated.

    Regards,
    Evgenia
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  13. Luis
    Luis avatar
    29 posts
    Member since:
    Dec 2013

    Posted 07 Nov 2014 Link to this post

    Hi i have a issue.
    when i change the theme in runtime all the controls with scrollbars go to the end (right side).
    and that  should not occur.

    can help me plizz 
  14. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 12 Nov 2014 Link to this post

    Hello Luis,

    It is hard for us to say what might cause this unwanted behavior on theme switch without knowing more details on your case - are you using implicit styles with NoXAML binaries, do you have any custom styles applied, which controls do you use? It will be better for us if you could send us a sample runnable project where we can reproduce it and get back to you with more adequate feedback.

    P.S. To be able to send us your runnable project you need to open new support thread. The reason is quite simple, really - we do not want people to share their projects publicly. Another advantage of using support threads is the shorter response time compared to forum posts.

    Best Regards,
    Evgenia
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
DevCraft banner