This question is locked. New answers and comments are not allowed.
I have taken your NumericIndicator inside a RadialScale and added a label. But its not working.
I created a templated control and inherited from NumericIndicator. I then updated the ControlTemplate with my extra TextBlock and Grid pattern. I added a new DependencyProperty to support this extra label. I thought I had set it all up correctly but obviously not. Blend nor Visual Studio will render the custom NumericIndicator and at runtime the NumericIndicator is missing. I'm not sure what I did wrong. Please help.
Generic.xaml
DescriptiveNumericIndicator.cs
MyGauge.xaml
Thanks for any help.
I created a templated control and inherited from NumericIndicator. I then updated the ControlTemplate with my extra TextBlock and Grid pattern. I added a new DependencyProperty to support this extra label. I thought I had set it all up correctly but obviously not. Blend nor Visual Studio will render the custom NumericIndicator and at runtime the NumericIndicator is missing. I'm not sure what I did wrong. Please help.
Generic.xaml
<Style TargetType="local:DescriptiveNumericIndicator"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:DescriptiveNumericIndicator"> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding CornerRadius}"> <Grid> <Grid.RowDefinitions> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <TextBlock Grid.Row="0" Text="{Binding DisplayName}" FontSize="12" HorizontalAlignment="Center"/> <ItemsPresenter Grid.Row="1"/> </Grid> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> DescriptiveNumericIndicator.cs
public class DescriptiveNumericIndicator : NumericIndicator { public DescriptiveNumericIndicator() { this.DefaultStyleKey = typeof(DescriptiveNumericIndicator); } public string DisplayName { get { return (string)GetValue(DisplayNameProperty); } set { SetValue(DisplayNameProperty, value); } } // Using a DependencyProperty as the backing store for DisplayName. This enables animation, styling, binding, etc... public static readonly DependencyProperty DisplayNameProperty = DependencyProperty.Register("DisplayName", typeof(string), typeof(DescriptiveNumericIndicator), new PropertyMetadata("Label")); } MyGauge.xaml
<local:DescriptiveNumericIndicator CornerRadius="5" Format="{}{0:F1}" Value="{Binding InnerGaugeCurrentValue}" Top=".5" Left=".45" FontSize="24" RelativeHeight=".3" RelativeWidth=".25" DisplayName="{Binding InnerGaugeName}">Thanks for any help.