<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"  
    xmlns:bgc="clr-namespace:BuzzGUI.Common;assembly=BuzzGUI.Common"             
    xmlns:vsm="clr-namespace:System.Windows;assembly=BuzzGUI.Common"             
    xmlns:local="clr-namespace:BuzzGUI.MachineView;assembly=BuzzGUI.MachineView">

  <Style x:Key="ContainerCanvasStyle" TargetType="{x:Type Canvas}">
    <Style.Triggers>
      <DataTrigger Binding="{Binding Settings.Shadows}" Value="All">
        <Setter Property="Effect">
          <Setter.Value>
            <DropShadowEffect Opacity="0.7" BlurRadius="10"/>
          </Setter.Value>
        </Setter>
      </DataTrigger>
    </Style.Triggers>
  </Style>

  <Style x:Key="SelectionRectangleStyle" TargetType="{x:Type Rectangle}">
    <Setter Property="RadiusX" Value="2"/>
    <Setter Property="RadiusY" Value="2"/>
    <Setter Property="Stroke">
      <Setter.Value>
        <SolidColorBrush Color="Black" Opacity="0.5"/>
      </Setter.Value>
    </Setter>
    <Setter Property="Fill">
      <Setter.Value>
        <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
          <GradientStop Offset="0" Color="#10000000"/>
          <GradientStop Offset="1" Color="#20000000"/>
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
  </Style>
  
  <Style x:Key="BackgroundGridStyleBase" TargetType="{x:Type Grid}">
    <Setter Property="Background">
      <Setter.Value>
        <SolidColorBrush Color="{Binding Path=Buzz.ThemeColors[MV Background]}"/>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- DataContext BuzzGUI.MachineView.Connection -->
  <Style x:Key="MachineConnectionTriangleStyleBase" TargetType="{x:Type Control}">
    <Setter Property="Focusable" Value="False"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Control}">

          <Polygon Name="polygon" Points="0,-9 -10,9 10,9" StrokeThickness="1">
            <Polygon.Stroke>
              <SolidColorBrush Color="{Binding Path=MachineGraph.Buzz.ThemeColors[MV Line]}"/>
            </Polygon.Stroke>
            <Polygon.Fill>
              <SolidColorBrush Color="{Binding Path=MachineGraph.Buzz.ThemeColors[MV Arrow]}"/>
            </Polygon.Fill>
          </Polygon>
            
          <!--
          <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding IsConnecting}" Value="True">
              <Setter TargetName="polygon" Property="Opacity" Value="0.5"/>
            </DataTrigger>
          </ControlTemplate.Triggers>
          -->
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- DataContext BuzzGUI.MachineView.Connection -->
  <Style x:Key="MachineConnectionPathStyleBase" TargetType="{x:Type Shape}">
    <Setter Property="IsHitTestVisible" Value="False"/>
    <Setter Property="StrokeThickness" Value="1"/>
    <Setter Property="Stroke">
      <Setter.Value>
        <SolidColorBrush Color="{Binding Path=MachineGraph.Buzz.ThemeColors[MV Line]}"/>
      </Setter.Value>
    </Setter>
    
    <Style.Triggers>
      <DataTrigger Binding="{Binding IsConnecting}" Value="True">
        <Setter Property="Opacity" Value="0.5"/>
      </DataTrigger>
    </Style.Triggers>
    
  </Style>

  <!-- DataContext BuzzGUI.MachineView.Connection.PlugInfo -->
  <Style x:Key="PlugStyle" TargetType="{x:Type Control}">
    <Setter Property="Width" Value="14"/>
    <Setter Property="Height" Value="14"/>
    <Setter Property="Focusable" Value="False"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Control}">
          <Grid>
            <Ellipse Name="ellipse" StrokeThickness="1">
              <Ellipse.Stroke>
                <SolidColorBrush Color="{Binding Path=Connection.MachineGraph.Buzz.ThemeColors[MV Line]}"/>
              </Ellipse.Stroke>
              <Ellipse.Fill>
                <SolidColorBrush Color="{Binding Path=Connection.MachineGraph.Buzz.ThemeColors[MV Arrow]}"/>
              </Ellipse.Fill>
            </Ellipse>
            <TextBlock Visibility="Visible" FontSize="11" FontFamily="Arial" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Path=Channel}"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>


  <Style TargetType="{x:Type MenuItem}">
    <Setter Property="Margin" Value="4,0,0,0" />
<!--
    <Setter Property="FontFamily" Value="Calibri, Tahoma" />
    <Setter Property="FontSize" Value="14" />
-->
  </Style>

  <Style x:Key="ContextMenuItemStyle">
    <Setter Property="MenuItem.Header" Value="{Binding Text}"/>
    <Setter Property="MenuItem.ItemsSource" Value="{Binding Children}"/>
    <Setter Property="MenuItem.Command" Value="{Binding Command}" />
    <Setter Property="MenuItem.CommandParameter" Value="{Binding CommandParameter}" />
    <Setter Property="MenuItem.IsEnabled" Value="{Binding IsEnabled}" />
    <Setter Property="MenuItem.IsChecked" Value="{Binding IsChecked}" />
    <Setter Property="MenuItem.InputGestureText" Value="{Binding GestureText}" />

    <Setter Property="MenuItem.Margin" Value="4,0,0,0" />
<!--
    <Setter Property="MenuItem.FontFamily" Value="Calibri, Tahoma" />
    <Setter Property="MenuItem.FontSize" Value="14" />
-->    
    
    <Style.Triggers>
      <DataTrigger Binding="{Binding IsSeparator}" Value="True">
        <Setter Property="MenuItem.Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type MenuItem}">
              <Separator Style="{DynamicResource {x:Static MenuItem.SeparatorStyleKey}}"/>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
        <Setter Property="MenuItem.Margin" Value="0,0,0,0" />
      </DataTrigger>

      <DataTrigger Binding="{Binding IsLabel}" Value="True">
        <Setter Property="MenuItem.Background" Value="LightSteelBlue"/>
        <Setter Property="MenuItem.Foreground" Value="Black"/>
        <Setter Property="MenuItem.Margin" Value="0,0,0,0" />
      </DataTrigger>

    </Style.Triggers>
    
  </Style>

  <Style x:Key="TopBorderStyle" TargetType="{x:Type Border}">
    <Setter Property="Height" Value="26"/>
    <Setter Property="BorderThickness" Value="0,0,0,1"/>
    <Setter Property="BorderBrush" Value="{StaticResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
    <Setter Property="Background">
      <Setter.Value>
        <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
          <GradientStop Color="{DynamicResource {x:Static SystemColors.ControlColorKey}}" Offset="0.0"/>
          <GradientStop Color="White" Offset="1.0"/>
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
  </Style>

  <LinearGradientBrush x:Key="GlassBrush" StartPoint="0,0" EndPoint="1,1" Opacity="0.5" po:Freeze="True">
    <GradientStop Color="WhiteSmoke" Offset="0.2" />
    <GradientStop Color="Transparent" Offset="0.4" />
    <GradientStop Color="WhiteSmoke" Offset="0.5" />
    <GradientStop Color="Transparent" Offset="0.75" />
    <GradientStop Color="WhiteSmoke" Offset="0.9" />
    <GradientStop Color="Transparent" Offset="1" />
  </LinearGradientBrush>

<!--
  <Style TargetType="{x:Type bgc:Knob}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type bgc:Knob}">
          <Viewbox>
            <Grid Name="KnobGrid">
              <Grid Name="RotatingLayer1">
                <Ellipse Name="bg" Width="32" Height="32" Stroke="Transparent" StrokeThickness="2">
                  <Ellipse.Fill>
                    <SolidColorBrush x:Name="anbr" Color="LightGray" />
                  </Ellipse.Fill>
                </Ellipse>
              </Grid>

              <Ellipse Width="32" Height="32" Fill="{StaticResource GlassBrush}" Stroke="Transparent" StrokeThickness="2"/>

              <Grid Name="RotatingLayer2">
                <Ellipse Width="32" Height="32" Stroke="Black" StrokeThickness="2"/>
                <Line X1="16" Y1="16" X2="16" Y2="0" Stroke="Black" StrokeThickness="2"/>
              </Grid>

            </Grid>
          </Viewbox>
          <ControlTemplate.Triggers>
            <EventTrigger RoutedEvent="Control.MouseEnter">
              <EventTrigger.Actions>
                <BeginStoryboard>
                  <Storyboard>
                    <ColorAnimation Storyboard.TargetName="anbr" Storyboard.TargetProperty="(SolidColorBrush.Color)"
                                        To="Pink" Duration="0:0:0.1"/>
                  </Storyboard>
                </BeginStoryboard>
              </EventTrigger.Actions>
            </EventTrigger>

            <EventTrigger RoutedEvent="Control.MouseLeave">
              <EventTrigger.Actions>
                <BeginStoryboard>
                  <Storyboard>
                    <ColorAnimation Storyboard.TargetName="anbr" Storyboard.TargetProperty="(SolidColorBrush.Color)"
                                        To="LightGray" Duration="0:0:0.2"/>
                  </Storyboard>
                </BeginStoryboard>
              </EventTrigger.Actions>
            </EventTrigger>

          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
-->

</ResourceDictionary>