<UserControl x:Class="TestGaugeApplication.Page" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" |
xmlns:control="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Gauge" |
xmlns:gauge="clr-namespace:Telerik.Windows.Controls.Gauges;assembly=Telerik.Windows.Controls.Gauge" |
Width="500" Height="400"> |
<UserControl.Resources> |
<ResourceDictionary> |
<DataTemplate x:Key="TickLabelEmpty"> |
<Grid /> |
</DataTemplate> |
|
<Style x:Key="MajorCustomTicks" TargetType="TextBlock"> |
<Setter Property="FontFamily" Value="Arial" /> |
<Setter Property="FontSize" Value="14" /> |
<Setter Property="FontWeight" Value="Bold" /> |
</Style> |
|
<ControlTemplate x:Key="CompasNeedleTemplate" TargetType="gauge:Needle"> |
<Grid x:Name="PART_Grid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> |
<Grid.ColumnDefinitions> |
<ColumnDefinition Width="*" /> |
<!-- Column 0 - tail --> |
<ColumnDefinition Width="*" /> |
<!-- Column 1 - pin point --> |
<ColumnDefinition Width="*" /> |
<!-- Column 2 - arrow --> |
</Grid.ColumnDefinitions> |
<Grid.RowDefinitions> |
<RowDefinition Height="*" /> |
</Grid.RowDefinitions> |
|
<Grid x:Name="PART_Shape" Grid.ColumnSpan="3" Margin="0"> |
<Grid.ColumnDefinitions> |
<ColumnDefinition Width="50*" /> |
<ColumnDefinition Width="50*" /> |
</Grid.ColumnDefinitions> |
<Grid.RowDefinitions> |
<RowDefinition Height="0.3*" /> |
<RowDefinition Height="0.4*" /> |
<RowDefinition Height="0.3*" /> |
</Grid.RowDefinitions> |
|
<Path Grid.Row="1" |
Grid.Column="1" |
Stretch="Fill" |
Fill="Blue" |
StrokeThickness="1"> |
<Path.Data> |
<PathGeometry> |
<PathFigure StartPoint="1,0.5"> |
<LineSegment Point="0,1" /> |
<LineSegment Point="0,0" /> |
</PathFigure> |
</PathGeometry> |
</Path.Data> |
</Path> |
|
<Path Grid.Row="1" |
Grid.Column="0" |
Stretch="Fill" |
Fill="Red" |
StrokeThickness="1"> |
<Path.Data> |
<PathGeometry> |
<PathFigure StartPoint="1,0"> |
<LineSegment Point="1,1" /> |
<LineSegment Point="0,0.5" /> |
</PathFigure> |
</PathGeometry> |
</Path.Data> |
</Path> |
</Grid> |
|
<Grid Grid.Column="1"> |
<Grid.RowDefinitions> |
<RowDefinition Height="0.125*" /> |
<RowDefinition Height="0.75*" /> |
<RowDefinition Height="0.125*" /> |
</Grid.RowDefinitions> |
<Grid.ColumnDefinitions> |
<ColumnDefinition Width="0.125*" /> |
<ColumnDefinition Width="0.75*" /> |
<ColumnDefinition Width="0.125*" /> |
</Grid.ColumnDefinitions> |
<Ellipse Grid.Column="1" Grid.Row="1" Stretch="Uniform" |
Fill="White"> |
</Ellipse> |
</Grid> |
|
<Grid Grid.Column="1"> |
<Grid.RowDefinitions> |
<RowDefinition Height="0.25*" /> |
<RowDefinition Height="0.5*" /> |
<RowDefinition Height="0.25*" /> |
</Grid.RowDefinitions> |
<Grid.ColumnDefinitions> |
<ColumnDefinition Width="0.25*" /> |
<ColumnDefinition Width="0.5*" /> |
<ColumnDefinition Width="0.25*" /> |
</Grid.ColumnDefinitions> |
<Ellipse Grid.Column="1" Grid.Row="1" Stretch="Uniform" |
Fill="White"> |
</Ellipse> |
</Grid> |
</Grid> |
</ControlTemplate> |
|
<Style x:Key="CompasNeedleStyle" TargetType="gauge:Needle"> |
<Setter Property="Location" Value="OverCenter" /> |
<Setter Property="RelativeHeight" Value="0.4" /> |
<Setter Property="RelativeShift" Value="1.4" /> |
<Setter Property="Template" Value="{StaticResource CompasNeedleTemplate}" /> |
</Style> |
</ResourceDictionary> |
</UserControl.Resources> |
<Grid x:Name="LayoutRoot" Background="White"> |
<control:RadGauge x:Name="radGauge" Width="350" Height="350"> |
<gauge:RadialGauge> |
<gauge:RadialScale StartAngle="270" |
SweepAngle="360" |
Radius="0.83" |
Min="0" |
Max="360" |
MajorTickStep="90" |
ShowLastLabel="False" |
LabelRotationMode="None"> |
<gauge:RadialScale.Label> |
<gauge:LabelProperties ItemTemplate="{StaticResource TickLabelEmpty}"> |
</gauge:LabelProperties> |
</gauge:RadialScale.Label> |
<gauge:TickList> |
<gauge:CustomTickMark Value="0"> |
<gauge:CustomTickMark.ItemTemplate> |
<DataTemplate> |
<Grid> |
<TextBlock Foreground="Blue" |
Style="{StaticResource MajorCustomTicks}" |
Text="N" /> |
</Grid> |
</DataTemplate> |
</gauge:CustomTickMark.ItemTemplate> |
</gauge:CustomTickMark> |
<gauge:CustomTickMark Value="90"> |
<gauge:CustomTickMark.ItemTemplate> |
<DataTemplate> |
<Grid> |
<TextBlock Foreground="Blue" |
Style="{StaticResource MajorCustomTicks}" |
Text="E" /> |
</Grid> |
</DataTemplate> |
</gauge:CustomTickMark.ItemTemplate> |
</gauge:CustomTickMark> |
<gauge:CustomTickMark Value="180"> |
<gauge:CustomTickMark.ItemTemplate> |
<DataTemplate> |
<Grid> |
<TextBlock Foreground="Blue" |
Style="{StaticResource MajorCustomTicks}" |
Text="S" /> |
</Grid> |
</DataTemplate> |
</gauge:CustomTickMark.ItemTemplate> |
</gauge:CustomTickMark> |
<gauge:CustomTickMark Value="270"> |
<gauge:CustomTickMark.ItemTemplate> |
<DataTemplate> |
<Grid> |
<TextBlock Foreground="Blue" |
Style="{StaticResource MajorCustomTicks}" |
Text="W" /> |
</Grid> |
</DataTemplate> |
</gauge:CustomTickMark.ItemTemplate> |
</gauge:CustomTickMark> |
</gauge:TickList> |
<gauge:IndicatorList> |
<gauge:Needle x:Name="needle" Style="{StaticResource CompasNeedleStyle}" /> |
</gauge:IndicatorList> |
</gauge:RadialScale> |
</gauge:RadialGauge> |
</control:RadGauge> |
</Grid> |
</UserControl> |