aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Controls/TouchIcon.xaml
blob: f1fd30b9977ae7242eaa7b650c8ff8b6a177390d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:localConverters="clr-namespace:Tango.Touch.Converters"
                    xmlns:local="clr-namespace:Tango.Touch.Controls">

    <localConverters:TouchIconKindToGeometryConverter x:Key="TouchIconKindToGeometryConverter" />

    <Style TargetType="{x:Type local:TouchIcon}">
        <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType=Control},Path=Foreground}"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:TouchIcon}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Path RenderTransformOrigin="0.5,0.5" Margin="{TemplateBinding Padding}" Stretch="Uniform" Fill="{TemplateBinding Foreground}" Data="{TemplateBinding Icon,Converter={StaticResource TouchIconKindToGeometryConverter}}">
                            <Path.RenderTransform>
                                <RotateTransform Angle="{Binding RelativeSource={RelativeSource AncestorType=local:TouchIcon},Path=Angle}" />
                            </Path.RenderTransform>
                        </Path>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>