|
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:bpa="clr-namespace:BPA.UIControl"
- xmlns:converter="clr-namespace:BPA.UIControl.Converters">
- <ResourceDictionary.MergedDictionaries>
- <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/Resources/Default.xaml" />
- </ResourceDictionary.MergedDictionaries>
-
- <!-- Converter -->
- <converter:GetCanvasCentreConverter x:Key="getCanvasCentre" />
-
- <Style TargetType="{x:Type bpa:Icon}">
- <Setter Property="FlowDirection" Value="LeftToRight" />
- <Setter Property="HorizontalAlignment" Value="Center" />
- <Setter Property="VerticalAlignment" Value="Center" />
- <Setter Property="IsTabStop" Value="False" />
- <Setter Property="Width">
- <Setter.Value>
- <MultiBinding Converter="{StaticResource MathAddConverter}">
- <Binding Path="FontSize" RelativeSource="{RelativeSource Self}" />
- <Binding Source="6" />
- </MultiBinding>
- </Setter.Value>
- </Setter>
- <Setter Property="Height" Value="{Binding Width, RelativeSource={RelativeSource Self}}" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type bpa:Icon}">
- <Border Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}">
- <Viewbox>
- <Canvas x:Name="canvas"
- Width="26"
- Height="26">
- <Path x:Name="icon"
- Data="{Binding Code, RelativeSource={RelativeSource TemplatedParent}}"
- Fill="{TemplateBinding Foreground}"
- Stretch="Uniform">
- <Canvas.Right>
- <MultiBinding Converter="{StaticResource getCanvasCentre}">
- <Binding ElementName="canvas" Path="ActualWidth" />
- <Binding ElementName="icon" Path="ActualWidth" />
- </MultiBinding>
- </Canvas.Right>
- <Canvas.Top>
- <MultiBinding Converter="{StaticResource getCanvasCentre}">
- <Binding ElementName="canvas" Path="ActualHeight" />
- <Binding ElementName="icon" Path="ActualHeight" />
- </MultiBinding>
- </Canvas.Top>
- </Path>
- </Canvas>
- </Viewbox>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ResourceDictionary>
|