Implicit Style Radial Ranges

2 posts, 0 answers
  1. Marc
    Marc avatar
    15 posts
    Member since:
    Oct 2007

    Posted 21 May 2013 Link to this post

    I have a solution where I am using the implicit themes and have a pallete switchers similar to what your Executive Dashboard is using. I have set up different gauge properties to switch when I click the theme toggle button. But i can not get the GaugeRange backgrounds to change. In fact they don't even display. Here is some sample code

    <telerik:RadialScale x:Name="innerChannelRadialScale" Min="0" Max="300" Radius="0.68" MajorTicks="10" MinorTicks="5" LabelRotationMode="None"
    FontWeight="Bold" FontSize="60" SweepAngle="359" StartAngle="90" ShowLastLabel="True" ShowFirstLabel="False"
    MajorTickBackground="{DynamicResource MajorTickBackground}"
    MiddleTickBackground="{DynamicResource MiddleTickBackground}"
    MinorTickBackground="{DynamicResource MinorTickBackground}">
    <telerik:RadialScale.Ranges>
           <telerik:GaugeRange x:Name="innerAlarmLowRange" Min="0" Max="50" StartWidth="0.04" EndWidth="0.01" Background="{DynamicResource AlertRangeBackground}" />
           <telerik:GaugeRange x:Name="innerNormalRange" Min="50" Max="250" StartWidth="0.01" EndWidth="0.01" Background="{DynamicResource NormalRangeBackground}" />
           <telerik:GaugeRange x:Name="innerAlarmHighRange" Min="250" Max="300" StartWidth="0.01" EndWidth="0.03" Background="#FFE50000" />
      </telerik:RadialScale.Ranges>

    You will see I have set up DynamicResources for all of the Tick Backgrounds and they work perfectly. But the GaugeRange backgrounds do not work at all. In fact they do not show up at all. Is there something special I need to do to set DynamicResources on these?
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 22 May 2013 Link to this post

    Hello Marc,

    The GaugeRange is a data object (not a framework element). As it is stated in the MSDN (http://msdn.microsoft.com/en-us/library/ms750613.aspx): dynamic resource references have some notable restrictions. At least one of the following must be true:
    • The property being set must be a property on a FrameworkElement or FrameworkContentElement. That property must be backed by a DependencyProperty.
    • The reference is for a value within a Style Setter.
    • The property being set must be a property on a Freezable that is provided as a value of either a FrameworkElement or FrameworkContentElement property, or a Setter value.

    So the Dynamic Resources can’t be used on the GaugeRange objects.

    Regards,
    Andrey Murzov
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

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