mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 01:58:30 +00:00
99 lines
5.1 KiB
XML
99 lines
5.1 KiB
XML
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:controls="clr-namespace:RGB.NET.WPF.Controls"
|
|
xmlns:converter="clr-namespace:RGB.NET.WPF.Converter">
|
|
|
|
<converter:ColorToSolidColorBrushConverter x:Key="ConverterColorToSolidColorBrush" />
|
|
|
|
<ControlTemplate x:Key="ControlTemplateLedRectangle"
|
|
TargetType="{x:Type controls:LedVisualizer}">
|
|
<Border VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
|
<Border.Background>
|
|
<ImageBrush AlignmentX="Center" AlignmentY="Center"
|
|
Stretch="Fill"
|
|
ImageSource="{Binding Led.Image, RelativeSource={RelativeSource TemplatedParent}}" />
|
|
</Border.Background>
|
|
|
|
<Rectangle VerticalAlignment="Stretch"
|
|
HorizontalAlignment="Stretch"
|
|
Opacity="0.5"
|
|
Stroke="{TemplateBinding BorderBrush}"
|
|
StrokeThickness="1"
|
|
Fill="{TemplateBinding Background}" />
|
|
</Border>
|
|
</ControlTemplate>
|
|
|
|
<ControlTemplate x:Key="ControlTemplateLedCircle"
|
|
TargetType="{x:Type controls:LedVisualizer}">
|
|
<Border VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
|
<Border.Background>
|
|
<ImageBrush AlignmentX="Center" AlignmentY="Center"
|
|
Stretch="Fill"
|
|
ImageSource="{Binding Led.Image, RelativeSource={RelativeSource TemplatedParent}}" />
|
|
</Border.Background>
|
|
|
|
<Ellipse VerticalAlignment="Stretch"
|
|
HorizontalAlignment="Stretch"
|
|
Opacity="0.5"
|
|
Stroke="{TemplateBinding BorderBrush}"
|
|
StrokeThickness="1"
|
|
Fill="{TemplateBinding Background}" />
|
|
</Border>
|
|
</ControlTemplate>
|
|
|
|
<ControlTemplate x:Key="ControlTemplateLedCustom"
|
|
TargetType="{x:Type controls:LedVisualizer}">
|
|
<Border x:Name="Border" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
|
<Border.Background>
|
|
<ImageBrush AlignmentX="Center" AlignmentY="Center"
|
|
Stretch="Fill"
|
|
ImageSource="{Binding Led.Image, RelativeSource={RelativeSource TemplatedParent}}" />
|
|
</Border.Background>
|
|
|
|
<Path Opacity="0.5"
|
|
Clip="{Binding Data, RelativeSource={RelativeSource Self}}"
|
|
Stroke="{TemplateBinding BorderBrush}"
|
|
StrokeThickness="2"
|
|
Fill="{TemplateBinding Background}">
|
|
<Path.Data>
|
|
<PathGeometry Figures="{Binding Led.ShapeData, RelativeSource={RelativeSource TemplatedParent}}">
|
|
<PathGeometry.Transform>
|
|
<ScaleTransform ScaleX="{Binding ActualWidth, ElementName=Border}"
|
|
ScaleY="{Binding ActualHeight, ElementName=Border}" />
|
|
</PathGeometry.Transform>
|
|
</PathGeometry>
|
|
</Path.Data>
|
|
</Path>
|
|
</Border>
|
|
</ControlTemplate>
|
|
|
|
<Style x:Key="StyleLedVisualizer"
|
|
TargetType="{x:Type controls:LedVisualizer}">
|
|
<Setter Property="Width" Value="{Binding Led.LedRectangle.Size.Width, RelativeSource={RelativeSource Self}}" />
|
|
<Setter Property="Height" Value="{Binding Led.LedRectangle.Size.Height, RelativeSource={RelativeSource Self}}" />
|
|
<Setter Property="Canvas.Left" Value="{Binding Led.LedRectangle.Location.X, RelativeSource={RelativeSource Self}}" />
|
|
<Setter Property="Canvas.Top" Value="{Binding Led.LedRectangle.Location.Y, RelativeSource={RelativeSource Self}}" />
|
|
|
|
<Setter Property="BorderBrush" Value="#A8202020" />
|
|
<Setter Property="Background" Value="{Binding Led.Color, RelativeSource={RelativeSource Self},
|
|
Converter={StaticResource ConverterColorToSolidColorBrush}}" />
|
|
|
|
<Setter Property="Template" Value="{StaticResource ControlTemplateLedRectangle}" />
|
|
|
|
<Style.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="BorderBrush" Value="#A8FFFFFF" />
|
|
</Trigger>
|
|
|
|
<DataTrigger Binding="{Binding Led.Shape, RelativeSource={RelativeSource Self}}" Value="Circle">
|
|
<Setter Property="Template" Value="{StaticResource ControlTemplateLedCircle}" />
|
|
</DataTrigger>
|
|
|
|
<DataTrigger Binding="{Binding Led.Shape, RelativeSource={RelativeSource Self}}" Value="Custom">
|
|
<Setter Property="Template" Value="{StaticResource ControlTemplateLedCustom}" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<Style TargetType="{x:Type controls:LedVisualizer}" BasedOn="{StaticResource StyleLedVisualizer}" />
|
|
|
|
</ResourceDictionary> |