This is a migrated thread and some comments may be shown as answers.

Problems in Simi-circle Gauge

2 Answers 137 Views
Gauges
This is a migrated thread and some comments may be shown as answers.
Anoop
Top achievements
Rank 1
Anoop asked on 08 Mar 2011, 11:05 AM

Hi all,

 

I am planning to use this gauge, However when I run the example it was not work in my application

Its giving me too much errors

 

Any idea?

The code is below and the picture which I need the same is attached



<demo:DynamicBasePage x:Class="Telerik.Windows.Examples.Gauge.Customization.HalfCircleGauges.Example"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                      xmlns:demo="clr-namespace:Telerik.Examples.Gauge"
                      xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls">
    <demo:DynamicBasePage.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Telerik.Windows.Controls.Gauge;component/Themes/Generic.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </demo:DynamicBasePage.Resources>
    <Grid>
        <Border telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled="True">
            <telerik:RadGauge x:Name="radGauge">
                <telerik:RadialGauge x:Name="radialGauge"
                                         Style="{StaticResource Office_BlackRadialGaugeHalfCircleNStyle}">
                    <telerik:RadialScale x:Name="radialScale"
                                             Style="{StaticResource Office_BlackRadialScaleHalfCircleNStyle}">
                        <telerik:RadialScale.MajorTick>
                            <telerik:MajorTickProperties />
                        </telerik:RadialScale.MajorTick>
                        <telerik:RadialScale.MiddleTick>
                            <telerik:MiddleTickProperties Length="0.05" TickWidth="0.2" />
                        </telerik:RadialScale.MiddleTick>
                        <telerik:RadialScale.MinorTick>
                            <telerik:MinorTickProperties Length="0.03" TickWidth="0.3" />
                        </telerik:RadialScale.MinorTick>
                        <telerik:IndicatorList>
                            <telerik:Needle x:Name="needle"
                                                IsAnimated="True"
                                                Value="65"/>
                        </telerik:IndicatorList>
                    </telerik:RadialScale>
                </telerik:RadialGauge>
            </telerik:RadGauge>
        </Border>
    </Grid>
  
    <telerikQuickStart:QuickStart.ConfigurationPanel>
        <StackPanel Margin="3">
            <TextBlock>Gauge orientation</TextBlock>
            <telerik:RadComboBox x:Name="gaugeStyle"
                                 SelectionChanged="gaugeStyle_SelectionChanged"
                                 Margin="0,2">
                <telerik:RadComboBoxItem DataContext="HalfCircleN" Content="North"/>
                <telerik:RadComboBoxItem DataContext="HalfCircleS" Content="South"/>
                <telerik:RadComboBoxItem DataContext="HalfCircleE" Content="East"/>
                <telerik:RadComboBoxItem DataContext="HalfCircleW" Content="West"/>
            </telerik:RadComboBox>
        </StackPanel>
    </telerikQuickStart:QuickStart.ConfigurationPanel>
</demo:DynamicBasePage>



Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports Telerik.Windows.Controls
Imports Telerik.Examples.Gauge
  
Namespace Telerik.Windows.Examples.Gauge.Customization.HalfCircleGauges
    ''' <summary>
    ''' Interaction logic for Example.xaml
    ''' </summary>
    Public Partial Class Example
        Inherits DynamicBasePage
        Public Sub New()
            InitializeComponent()
  
            Me.gaugeStyle.SelectedIndex = 0
        End Sub
  
        Protected Overloads Overrides Sub NewValue()
            needle.Value = radialScale.Min + (radialScale.Max - radialScale.Min) * rnd.NextDouble()
        End Sub
  
        Private Sub gaugeStyle_SelectionChanged(sender As Object, e As SelectionChangedEventArgs)
            If gaugeStyle IsNot Nothing AndAlso gaugeStyle.SelectedItem IsNot Nothing Then
                Dim styleName As String = DirectCast(TryCast(gaugeStyle.SelectedItem, RadComboBoxItem).DataContext, String)
  
                radGauge.Width = 340
                radGauge.Height = 200
  
                If styleName.EndsWith("E") OrElse styleName.EndsWith("W") Then
                    Dim tmp As Double = radGauge.Width
                    radGauge.Width = radGauge.Height
                    radGauge.Height = tmp
                End If
  
                Dim theme As Theme = StyleManager.GetTheme(radGauge)
                If theme Is Nothing Then
                    theme = StyleManager.ApplicationTheme
                End If
  
                Dim themeName As String = "Office_Black"
                If theme IsNot Nothing Then
                    themeName = theme.ToString()
                End If
  
                Dim gaugeStyleName As String = themeName & "RadialGauge" & styleName & "Style"
                Dim scaleStyleName As String = themeName & "RadialScale" & styleName & "Style"
  
                radialGauge.Style = TryCast(Me.Resources(gaugeStyleName), Style)
                radialScale.Style = TryCast(Me.Resources(scaleStyleName), Style)
            End If
        End Sub
    End Class
End Namespace


Thanks in advance

2 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 10 Mar 2011, 12:33 PM
Hello Anoop,

I have attached a sample solution which uses the semi-circle gauge you need.
I hope it helps.
Also I would recommend that you take a look to the Semicircle gauge topic of our online documentation:
http://www.telerik.com/help/wpf/radial-scale-semicircle-gauge.html

Kind regards,
Andrey Murzov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Anoop
Top achievements
Rank 1
answered on 13 Mar 2011, 08:52 AM

It’s not opening with me

 

am using Visual Studio 2008

Tags
Gauges
Asked by
Anoop
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Anoop
Top achievements
Rank 1
Share this question
or