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

Gauge not shown

3 Answers 76 Views
Gauge
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Yonggu Kang
Top achievements
Rank 1
Iron
Yonggu Kang asked on 12 Apr 2011, 05:15 PM
Hi telerik team,

I succeeded to load RadGauge on my view and bind to my bisiness object,
so I created style in order to bind many gauges in itemscontrol,however
gauge is not shown but needle only does. Following is my style in resource dictionary.
 
<Style x:Key="GaugeStyle" TargetType="telerik:HeaderedContentControl">
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerik:HeaderedContentControl">
                    <Border Style="{StaticResource BorderStyle}" Margin="2">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="30"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="0.65*"/>
                                <ColumnDefinition Width="0.35*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Text="{Binding Path=HeatPartName}" Style="{StaticResource TextBlockStyle}"/>
                            <TextBlock Grid.Column="1" Text="{Binding Path=CurrentThermo}" Style="{StaticResource TextBlockStyle}"
                                HorizontalAlignment="Right" />
  
                            <ContentPresenter Grid.Row="1">
                                <ContentPresenter.Content>
                                    <telerik:RadGauge  Grid.Row="1" Margin="3"
                                        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                            <telerik:RadialScale 
                                                         Min="0" Max="40" MajorTicks="8" MiddleTicks="4" 
                                                         LabelRotationMode="Automatic">
  
                                                <telerik:RadialScale.MajorTick>
                                                    <telerik:MajorTickProperties Length="0.1"/>
                                                </telerik:RadialScale.MajorTick>
                                                <telerik:RadialScale.MiddleTick>
                                                    <telerik:MiddleTickProperties Length="0.07" />
                                                </telerik:RadialScale.MiddleTick>
  
                                                <telerik:RadialScale.Label>
                                                    <telerik:LabelProperties FontSize="8" />
                                                </telerik:RadialScale.Label>
  
                                                <telerik:RadialRange Min="{Binding Path=Model.StdThermoLow}" Max="{Binding Path=Model.StdThermoHigh}" StartWidth="0.05" EndWidth="0.05" Background="Green"
                                                             TickBackground="Green" LabelForeground="Green" IndicatorBackground="Green" />
                                                <telerik:IndicatorList>
                                                    <telerik:RadialBar IsAnimated="True" Value="{Binding Path=Model.CurrentThermo}" />
                                                    <telerik:Needle IsAnimated="true" Value="{Binding Path=Model.CurrentThermo}" />
                                                </telerik:IndicatorList>
                                            </telerik:RadialScale>
                                        </Grid>
                                    </telerik:RadGauge>
                                </ContentPresenter.Content>
                            </ContentPresenter>
  
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

I guess I missed static resouce,so added style with resource dictinary as bellows
but view unresponed for a long time and  finally complains stack overflow saying
"element is already another child of ..".

<ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Fonts.xaml"/>
        <ResourceDictionary Source="/Telerik.Windows.Controls.Gauge;component/Themes/Generic.xaml" />
</ResourceDictionary.MergedDictionaries>

Style is added as follows with above code.

 <telerik:RadGauge   Style="{StaticResource RadialGaugeHalfCircleNStyle}">
and
 <telerik:RadialScale Style="{StaticResource RadialScaleHalfCircleNStyle}"

I heared it hurts performance when using sperated module with separate dictionary,
but it looks my ignorance to apply style in this case.

Any sample or advice would be highly appreciated.
Thank you in advance.

RGDS
Kang



3 Answers, 1 is accepted

Sort by
0
Yonggu Kang
Top achievements
Rank 1
Iron
answered on 15 Apr 2011, 03:55 AM
Any thoughts ?

Thanks
0
Andrey
Telerik team
answered on 15 Apr 2011, 06:30 AM
Hi Yong-Gu Kang,

You have missed the RadialGauge container which should be used as the container for the RadialScale element.
<ContentPresenter.Content>
 <telerik:RadGauge  Grid.Row="1" Margin="3">
  <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
   <telerik:RadialGauge>
    <telerik:RadialScale 
     Min="0" Max="40" MajorTicks="8" MiddleTicks="4" 
     LabelRotationMode="Automatic">
...
    </telerik:RadialScale>
   </telerik:RadialGauge>
  </Grid>
 </telerik:RadGauge>
</ContentPresenter.Content>

The tick marks and labels have white colour when you use default theme.
So, they are invisible.

Second thing I would note is the following use of the RadialGaugeHalfCircleNStyle style is incorrect:
<telerik:RadGauge Style="{StaticResource RadialGaugeHalfCircleNStyle}">

Its target is the RadialGauge control and it cannot be applied to the RadGauge.


Kind regards,
Andrey Murzov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Yonggu Kang
Top achievements
Rank 1
Iron
answered on 16 Apr 2011, 03:28 AM
Hi Andrey,

Thank you for your kind reply and I'm feel sorry to bother you with this simple thing.
Though I read your document a time, I might not  understand RadGause control full enough.

Thank you again.

RGDS

Kang


Tags
Gauge
Asked by
Yonggu Kang
Top achievements
Rank 1
Iron
Answers by
Yonggu Kang
Top achievements
Rank 1
Iron
Andrey
Telerik team
Share this question
or