Problem with Needle.TailHeight

4 posts, 0 answers
  1. David
    David avatar
    57 posts
    Member since:
    Apr 2011

    Posted 23 Dec 2011 Link to this post

    Hi,

    I'm using the new RadRadialGauge (Q3 2011 SP1) to build a user control to visualize a valve. This valve should show a perfectly horizontal line if the valve is completely closed with a value of 0 and a perfectly vertical line if the valve is completely open with a value of 100. If the valve has a value of 50, the line will be a perfect diagonal line pointing north-west to south-east.

    I'm created the following user control that works:
    <UserControl
        x:Class="ucValve"
        d:DesignHeight="48"
        d:DesignWidth="48"
        mc:Ignorable="d">
        <Grid>
            <telerik:RadRadialGauge>
                <telerik:RadRadialGauge.InnerBackground>
                    <SolidColorBrush />
                </telerik:RadRadialGauge.InnerBackground>
                <telerik:RadRadialGauge.InnerBorderBrush>
                    <SolidColorBrush />
                </telerik:RadRadialGauge.InnerBorderBrush>
                <telerik:RadRadialGauge.OuterBackground>
                    <SolidColorBrush />
                </telerik:RadRadialGauge.OuterBackground>
                <telerik:RadRadialGauge.OuterBorderBrush>
                    <SolidColorBrush />
                </telerik:RadRadialGauge.OuterBorderBrush>
                <telerik:RadialScale
                    x:Name="Scale"
                    MajorTickRelativeHeight="0"
                    MajorTicks="0"
                    Max="100"
                    Min="0"
                    Radius="1.25"
                    StartAngle="180"
                    SweepAngle="90">
                    <telerik:RadialScale.Indicators>
                        <telerik:Needle
                            x:Name="Needle"
                            BorderBrush="Black">
                            <telerik:Needle.Style>
                                <Style TargetType="{x:Type telerik:Needle}" >
                                    <Setter Property="telerik:ScaleObject.Location" Value="Inside" />
                                    <Setter Property="telerik:ScaleObject.RelativeWidth" Value="0.05" />
                                </Style>                           
                            </telerik:Needle.Style>
                        </telerik:Needle>
                        <telerik:Pinpoint
                            Background="Black"
                            BorderThickness="1">
                            <telerik:Pinpoint.Style>
                                <Style
                                    TargetType="{x:Type telerik:Pinpoint}">
                                    <Setter Property="telerik:ScaleObject.Location" Value="Inside" />
                                    <Setter Property="telerik:ScaleObject.RelativeHeight" Value="0.2" />
                                    <Setter Property="telerik:ScaleObject.RelativeWidth" Value="0.2" />
                                </Style>
                            </telerik:Pinpoint.Style>
                        </telerik:Pinpoint>
                    </telerik:RadialScale.Indicators>
                    <telerik:RadialScale.LabelTemplate>
                        <DataTemplate />
                    </telerik:RadialScale.LabelTemplate>
                </telerik:RadialScale>
            </telerik:RadRadialGauge>
        </Grid>
    </UserControl>
    with the following code behind:
    Imports System.ComponentModel
     
    Public Class ucValve
     
        Public Sub New()
            InitializeComponent()
            Value = valueDefaultValue
        End Sub
     
    #Region "Properties"
        Private Const valueDefaultValue As Double = 0
     
        <Category("Common"), DefaultValue(valueDefaultValue)>
        Public Property Value As Double
            Get
                Return Needle.Value
            End Get
            Set(ByVal value As Double)
                Needle.Value = value
            End Set
        End Property
     
        Public ReadOnly Property Maximum As Double
            Get
                Return Scale.Max
            End Get
        End Property
     
        Public ReadOnly Property Minimum As Double
            Get
                Return Scale.Min
            End Get
        End Property
    #End Region
    End Class

    This successfully renders the top left half of the valve. To render the bottom right half of the value, I change the XAML:
    <telerik:Needle
        x:Name="Needle"
        BorderBrush="Black">
    to:
    <telerik:Needle
        x:Name="Needle"
        BorderBrush="Black"
        TailHeight="1">

    While the user control successfully displays the bottom right half of the valve, when I embed this new user control into a window, I get the following error message:

    An Unhandled Exception has occurred
    '-INF' is not a valid value for property 'Height'.
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       at Telerik.Windows.Controls.Gauge.Needle.Resize() in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\Indicators\Needle.cs:line 96
       at Telerik.Windows.Controls.Gauge.ScaleObject.OnValueChanged(DependencyObject source) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\ScaleObject.cs:line 399
       at Telerik.Windows.Controls.Gauge.InteractiveIndicator.RefreshIndicator() in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\Indicators\InteractiveIndicator.cs:line 237
       at Telerik.Windows.Controls.Gauge.InteractiveIndicator.OnValueChanged(Double oldValue, Double newValue) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\Indicators\InteractiveIndicator.cs:line 190
       at Telerik.Windows.Controls.Gauge.GraphicIndicator.InternalValuePropertyChangedHandler(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs eventArgs) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\Indicators\GraphicIndicator.cs:line 644
       at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       at Telerik.Windows.Controls.Gauge.IndicatorHelper.RefreshInternalValue(GraphicIndicator indicator, Double value) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\Indicators\IndicatorHelper.cs:line 223
       at Telerik.Windows.Controls.Gauge.IndicatorHelper.CoerceValueProperty(DependencyObject source, Object value) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\Indicators\IndicatorHelper.cs:line 72
       at System.Windows.DependencyObject.ProcessCoerceValue(DependencyProperty dp, PropertyMetadata metadata, EntryIndex& entryIndex, Int32& targetIndex, EffectiveValueEntry& newEntry, EffectiveValueEntry& oldEntry, Object& oldValue, Object baseValue, Object controlValue, CoerceValueCallback coerceValueCallback, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, Boolean skipBaseValueChecks)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
       at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       at Telerik.Windows.Controls.Gauge.GraphicIndicator.set_Value(Double value) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Controls\DataVisualization\Gauge\Indicators\GraphicIndicator.cs:line 385
       at AlentControls.ucValve.set_Value(Double value) in C:\Utveckling\Alent\AlentControls\ucValve.xaml.vb:line 19
       at AlentControls.ucValve..ctor() in C:\Utveckling\Alent\AlentControls\ucValve.xaml.vb:line 7

    If I remove setting the TailHeight property to 1, it works. If I set the TailHeight property to any value, the above unhandled exception occurs.

    Am I doing something wrong or is this an issue with the new RadRadialGauge (specifically, the Needle object).

    Kind regards,
    Dave.
  2. Sia
    Admin
    Sia avatar
    667 posts

    Posted 28 Dec 2011 Link to this post

    Hello Dave,

    Thank you for reporting this issue.

    However, it is hard to replicate the exact issue from details provided. Please check the attached image. We appreciate if you open a formal support ticket and send us a sample runnable project which demonstrates the unwanted behavior. Thus we will do our best to provide you with a working solution. Thank you in advance for your cooperation.

    Regards,
    Sia
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. David
    David avatar
    57 posts
    Member since:
    Apr 2011

    Posted 30 Dec 2011 Link to this post

    Hi Sia,

    Thanks for your reply. As requested, I've submitted a formal support ticket with a project containing the issue.

    The error message occurs when the user control is embedded into any other component. While the user component containing the additionalTailHeight="1" successfully opens in design view, trying to embed this user control in any other component fails with a red cross where the user control should be with the described error message in design view and crashes when run.

    Kind regards,
    Dave.
  5. Sia
    Admin
    Sia avatar
    667 posts

    Posted 03 Jan 2012 Link to this post

    Hello Dave,

    I am copying my response from the other thread:

    Thank you for the provided details and the thorough information. Unfortunately I should confirm that this is issue with our control. It is already logged and forwarded to our developers. You can track its progress in our Public Issues Tracking system.

    Kind regards,
    Sia
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top