This question is locked. New answers and comments are not allowed.
In order to get rid of the large border around the linear gauge (OuterBackground) I have customized the control templates following the guidelines in the documentation.
However, in an effort to reproduce a similar look, I added some elements that gave that same glassy background look. I get in trouble however, trying to figure out how to set the size of a an arcsegment that does the glassy white semi-circle at the top.
I can easily get the path and arcsegment to the right place, but I can't set it's width properly because an arcsegment takes a point, and I don't see how to set that. For example.... I would want something like this:
<ArcSegment Point="{TemplateBinding Width}, 0" Size="10,7"/>Obviously I can't do that.
- What's the best way to set that value considering it sits inside a border element that has a width? Do I have to fully customize the control and add a new dependency property to that control?
- Is there some easier method to hide that background border that I've missed?
- Expression Blend can't seem to create the templates for the LinearGauge. Am I doing something wrong? it works fine on the other RadControls I've templated.
Thanks for any help!!!
Full Markup for the custom template:
<ControlTemplate x:Key="NewGaugeBackground" TargetType="ContentControl"> <Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="5"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="5"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="5"/> <RowDefinition Height="*"/> <RowDefinition Height="5"/> </Grid.RowDefinitions> <Border Grid.ColumnSpan="3" Grid.RowSpan="3" Background="#FF222222" /> <Border Grid.Row="1" Grid.Column="1" Margin="5" Opacity=".25" CornerRadius="4"> <Path StrokeThickness="1" Fill="White" Opacity=".5"> <Path.Data> <PathGeometry> <PathFigure IsClosed="True" StartPoint="0,0" IsFilled="True"> <ArcSegment Point="Needs to be width, 0" Size="10,7"/> </PathFigure > </PathGeometry> </Path.Data> </Path> <Border.Background> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="White" Offset="0.755"/> <GradientStop Color="White"/> <GradientStop Color="#FFCCCCCC" Offset="0.321"/> <GradientStop Color="#FF2F2F2F" Offset="0.105"/> <GradientStop Color="#FF8A8A8A" Offset="0.536"/> <GradientStop Color="#FEB3B3B3" Offset="0.962"/> <GradientStop Color="#FFBBBBBB" Offset="1"/> </LinearGradientBrush> </Border.Background> </Border> </Grid> </ControlTemplate> <ControlTemplate x:Key="NewGaugeForeground" TargetType="ContentControl"> <Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" /> </ControlTemplate> <ControlTemplate x:Key="NewGaugeTemplate" TargetType="telerik:LinearGauge"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> <Grid> <ContentControl Template="{StaticResource NewGaugeBackground}"/> <ItemsPresenter /> <ContentControl Template="{StaticResource NewGaugeForeground}"/> </Grid> </Border> </ControlTemplate> <Style x:Key="NewGaugeStyle" TargetType="telerik:LinearGauge"> <Setter Property="Template" Value="{StaticResource NewGaugeTemplate}" /> </Style>