<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Telerik.UI.Xaml.Controls.DataVisualization"
    xmlns:localTheming="using:Telerik.UI.Xaml.Controls.DataVisualization.Theming"
    xmlns:bulletGraph="using:Telerik.UI.Xaml.Controls.DataVisualization.BulletGraph">
    
    <localTheming:PaletteInitializer x:Key="PaletteInitializer"/>

    <bulletGraph:ValueToVisibilityConverter x:Key="ZeroToCollapsedConverter" Visibility="Collapsed"/>
    <bulletGraph:ValueToVisibilityConverter x:Key="ZeroToVisibleConverter" Visibility="Visible"/>
    
    <DataTemplate x:Key="LabelTemplate">
        <TextBlock Text="{Binding}" FontSize="12" Foreground="{StaticResource TelerikGaugeRangeForegroundBrush}"/>
    </DataTemplate>
    
    <Style TargetType="local:RadLinearGauge">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:RadLinearGauge">
                    <local:LinearGaugePanel x:Name="PART_Panel" local:RadLinearGauge.Orientation="{TemplateBinding Orientation}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="LabelTemplate" Value="{StaticResource LabelTemplate}"/>
        <Setter Property="TickTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Rectangle Width="2" Height="4" Fill="{StaticResource TelerikGaugeTickBackgroundBrush}"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="local:RadRadialGauge">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:RadRadialGauge">
                    <local:RadialGaugePanel x:Name="PART_Panel"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="LabelTemplate" Value="{StaticResource LabelTemplate}"/>
        <Setter Property="TickTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Rectangle Width="4" Height="2" Fill="{StaticResource TelerikGaugeTickBackgroundBrush}"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>        

    <Style TargetType="local:LinearBarGaugeIndicator">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:LinearBarGaugeIndicator">
                    <Canvas>
                        <Rectangle x:Name="PART_Bar" Fill="{TemplateBinding Brush}" StrokeThickness="{TemplateBinding BorderThickness}" Stroke="{TemplateBinding BorderBrush}" RenderTransformOrigin="0.5, 0.5"/>
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:ArrowGaugeIndicator">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ArrowGaugeIndicator">
                    <Grid x:Name="PART_Layout" RenderTransformOrigin="0.5, 0.5">
                        <Path x:Name="PART_Path" 
                              StrokeThickness="{TemplateBinding Thickness}"
                              Stroke="{TemplateBinding Brush}"
                              Fill="{TemplateBinding Brush}">
                            <Path.Data>
                                <GeometryGroup>
                                    <PathGeometry>
                                        <PathFigure x:Name="PART_ArrowHead" IsClosed="True">
                                            <LineSegment x:Name="PART_ArrowBottom"/>
                                            <LineSegment x:Name="PART_ArrowTop"/>
                                        </PathFigure>
                                    </PathGeometry>
                                    <LineGeometry x:Name="PART_ArrowShaft"/>
                                    <EllipseGeometry x:Name="PART_ArrowTail" RadiusX="2" RadiusY="2"/>
                                </GeometryGroup>
                            </Path.Data>
                        </Path>
                        <Grid.RenderTransform>
                            <RotateTransform x:Name="PART_NeedleRotateTransform"/>
                        </Grid.RenderTransform>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:RadialBarGaugeIndicator">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:RadialBarGaugeIndicator">
                    <Grid>
                        <Path x:Name="PART_Path" StrokeThickness="{TemplateBinding Thickness}" Stroke="{TemplateBinding Brush}">
                            <Path.Data>
                                <PathGeometry>
                                    <PathGeometry.Figures>
                                        <PathFigure x:Name="PART_Figure"/>
                                    </PathGeometry.Figures>
                                </PathGeometry>
                            </Path.Data>
                        </Path>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:MarkerGaugeIndicator">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:MarkerGaugeIndicator">
                    <Canvas x:Name="PART_Canvas">
                        <ContentPresenter x:Name="PART_VisualElement"
                                          Content="{TemplateBinding Content}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          RenderTransformOrigin="0.5, 0.5">
                            <ContentPresenter.RenderTransform>
                                <RotateTransform x:Name="PART_VisualElementRotation"/>
                            </ContentPresenter.RenderTransform>
                        </ContentPresenter>
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:SegmentedGaugeIndicator" x:Key="BaseSegmentedIndicatorStyle">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:SegmentedGaugeIndicator">
                    <Grid x:Name="PART_Layout"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="local:SegmentedLinearGaugeIndicator" BasedOn="{StaticResource BaseSegmentedIndicatorStyle}"/>
    
    <Style TargetType="local:SegmentedRadialGaugeIndicator" BasedOn="{StaticResource BaseSegmentedIndicatorStyle}"/>

    <Style TargetType="local:BarIndicatorSegment">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:BarIndicatorSegment">
                    <Canvas x:Name="PART_Layout"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:RadBulletGraph">
        <Setter Property="FeaturedMeasureBrush" Value="{StaticResource TelerikBulletGraphFeaturedMeasureBackgroundBrush}"/>
        <Setter Property="FeaturedMeasureAlternativeTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Ellipse Width="10" Height="15" Fill="{StaticResource TelerikBulletGraphFeaturedMeasureBackgroundBrush}"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ComparativeMeasureTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Rectangle Width="3" Height="15" Fill="{StaticResource TelerikBulletGraphComparitiveMeasureBackgroundBrush}"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="TickTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Rectangle Width="2" Height="7" Fill="{StaticResource TelerikBulletGraphTickBackgroundBrush}"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:RadBulletGraph">
                    <local:RadLinearGauge x:Name="PART_Scale"
                                            MinValue="{TemplateBinding StartValue}"
                                            MaxValue="{TemplateBinding EndValue}"
                                            TickStep="{TemplateBinding TickStep}"
                                            LabelStep="{TemplateBinding LabelStep}"
                                            LabelOffset="{TemplateBinding LabelOffset}"
                                            local:RadLinearGauge.Orientation="{TemplateBinding Orientation}"
                                            TickTemplate="{TemplateBinding TickTemplate}"
                                            LabelTemplate="{TemplateBinding LabelTemplate}">

                        <local:SegmentedLinearGaugeIndicator x:Name="PART_QualitativeBar"
                                                             Value="{TemplateBinding EndValue}"
                                                             local:RadLinearGauge.IndicatorOffset="-15"
                                                             Canvas.ZIndex="0"/>
                        <local:LinearBarGaugeIndicator x:Name="PART_FeaturedMeasure"
                                                       Value="{TemplateBinding FeaturedMeasure}"
                                                       Brush="{TemplateBinding FeaturedMeasureBrush}"
                                                       Thickness="{TemplateBinding FeaturedMeasureThickness}"
                                                       local:RadLinearGauge.IndicatorOffset="-15"
                                                       StartValue="{TemplateBinding FeaturedMeasureStartValue}"
                                                       Visibility="{Binding ElementName=PART_BulletGraphScale, Path=MinValue, Converter={StaticResource ZeroToVisibleConverter}}"
                                                       Canvas.ZIndex="3"
                                                       IsAnimated="{TemplateBinding IsAnimated}"/>
                        <local:LinearBarGaugeIndicator x:Name="PART_ProjectedMeasure"
                                                       Value="{TemplateBinding ProjectedMeasure}"
                                                       Brush="{TemplateBinding ProjectedMeasureBrush}"
                                                       StartValue="{TemplateBinding FeaturedMeasureStartValue}"
                                                       Thickness="{Binding Thickness, ElementName=PART_FeaturedMeasure}"
                                                       local:RadLinearGauge.IndicatorOffset="-15"
                                                       Canvas.ZIndex="1"/>
                        <local:MarkerGaugeIndicator x:Name="PART_AlternativeFeaturedMeasure"
                                                    Value="{TemplateBinding FeaturedMeasure}"
                                                    local:RadLinearGauge.IndicatorOffset="-20"
                                                    Visibility="{Binding ElementName=PART_BulletGraphScale, Path=MinValue, Converter={StaticResource ZeroToCollapsedConverter}}"
                                                    ContentTemplate="{TemplateBinding FeaturedMeasureAlternativeTemplate}"
                                                    IsRotated="True"
                                                    Canvas.ZIndex="3"/>
                        <local:MarkerGaugeIndicator x:Name="PART_ComparativeMeasure"
                                                    IsRotated="True"
                                                    local:RadLinearGauge.IndicatorOffset="-15"
                                                    Value="{TemplateBinding ComparativeMeasure}"
                                                    Canvas.ZIndex="2"
                                                    ContentTemplate="{TemplateBinding ComparativeMeasureTemplate}"/>
                    </local:RadLinearGauge>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary> 
