@@ -517,16 +517,17 @@ Copyright (c) 2022 OPTIKEY LTD (UK company number 11854839) - All Rights Reserve
517517 </MultiDataTrigger .Setters>
518518 </MultiDataTrigger >
519519
520+ <!-- N.B. If implemented here the trigger conflicts with key down animation crashing the program, therefore it must be handled as a standalone visual element: see Style x:Key="KeyDownStyle"-->
520521 <!-- This key state is down and has a keydown override-->
521- <MultiDataTrigger >
522+ <!-- < MultiDataTrigger>
522523 <MultiDataTrigger.Conditions>
523524 <Condition Binding="{Binding Path=KeyDownState, RelativeSource={RelativeSource AncestorType={x:Type controls:Key}}, Mode=OneWay}" Value="{x:Static enums:KeyDownStates.Down}" />
524525 <Condition Binding="{Binding Path=KeyDownBackgroundOverride, RelativeSource={RelativeSource AncestorType={x:Type controls:Key}}, Converter={StaticResource OverrideHasValue}, Mode=OneWay}" Value="True" />
525526 </MultiDataTrigger.Conditions>
526527 <MultiDataTrigger.Setters>
527528 <Setter Property="Background" Value="{Binding Path=KeyDownBackgroundOverride, RelativeSource={RelativeSource AncestorType={x:Type controls:Key}}, Converter={StaticResource CloneBrush}, Mode=OneWay}" />
528529 </MultiDataTrigger.Setters>
529- </MultiDataTrigger >
530+ </MultiDataTrigger>-->
530531
531532 <!-- This key state is locked down and has a keydown override-->
532533 <MultiDataTrigger >
@@ -551,6 +552,23 @@ Copyright (c) 2022 OPTIKEY LTD (UK company number 11854839) - All Rights Reserve
551552 </MultiDataTrigger >
552553 </Style .Triggers>
553554 </Style >
555+
556+ <Style x : Key =" KeyDownStyle" TargetType =" {x:Type Border}" >
557+ <Setter Property =" Background" Value =" Transparent" />
558+ <Setter Property =" BorderThickness" Value =" 0" />
559+ <Style .Triggers>
560+ <!-- This key state is down and has a keydown override-->
561+ <MultiDataTrigger >
562+ <MultiDataTrigger .Conditions>
563+ <Condition Binding =" {Binding Path=KeyDownState, RelativeSource={RelativeSource AncestorType={x:Type controls:Key}}, Mode=OneWay}" Value =" {x:Static enums:KeyDownStates.Down}" />
564+ <Condition Binding =" {Binding Path=KeyDownBackgroundOverride, RelativeSource={RelativeSource AncestorType={x:Type controls:Key}}, Converter={StaticResource OverrideHasValue}, Mode=OneWay}" Value =" True" />
565+ </MultiDataTrigger .Conditions>
566+ <MultiDataTrigger .Setters>
567+ <Setter Property =" Background" Value =" {Binding Path=KeyDownBackgroundOverride, RelativeSource={RelativeSource AncestorType={x:Type controls:Key}}, Converter={StaticResource CloneBrush}, Mode=OneWay}" />
568+ </MultiDataTrigger .Setters>
569+ </MultiDataTrigger >
570+ </Style .Triggers>
571+ </Style >
554572
555573 <Style x : Key =" CurrentKeyBorderHighlightStyle" TargetType =" {x:Type Border}" >
556574 <Setter Property =" BorderThickness" Value =" 5" />
@@ -634,65 +652,67 @@ Copyright (c) 2022 OPTIKEY LTD (UK company number 11854839) - All Rights Reserve
634652 <ControlTemplate TargetType =" {x:Type controls:Key}" >
635653 <Grid >
636654 <Border Style =" {StaticResource KeyBorderStyle}" >
637- <Grid >
638- <Grid .RowDefinitions>
639- <RowDefinition Height =" 1*" />
640- <RowDefinition Height =" 2*" />
641- <RowDefinition Height =" 1*" />
642- </Grid .RowDefinitions>
643- <ContentControl Grid.RowSpan=" 3" >
644- <!-- Enforce size limits of one key high/wide using the Span info on the key-->
645- <ContentControl .MaxWidth>
646- <MultiBinding Converter =" {StaticResource LengthDividedBySpan}" >
647- <MultiBinding .Bindings>
648- <Binding Path =" ActualWidth" RelativeSource =" {RelativeSource AncestorType={x:Type Grid}}" />
649- <Binding Path =" WidthSpan" RelativeSource =" {RelativeSource AncestorType={x:Type controls:Key}}" />
650- </MultiBinding .Bindings>
651- </MultiBinding >
652- </ContentControl .MaxWidth>
653- <ContentControl .MaxHeight>
654- <MultiBinding Converter =" {StaticResource LengthDividedBySpan}" >
655- <MultiBinding .Bindings>
656- <Binding Path =" ActualHeight" RelativeSource =" {RelativeSource AncestorType={x:Type Grid}}" />
657- <Binding Path =" HeightSpan" RelativeSource =" {RelativeSource AncestorType={x:Type controls:Key}}" />
658- </MultiBinding .Bindings>
659- </MultiBinding >
660- </ContentControl .MaxHeight>
661- <Grid >
662- <Grid .ColumnDefinitions>
663- <ColumnDefinition Width =" 1*" />
664- <ColumnDefinition Width =" 2*" />
665- <ColumnDefinition Width =" 8*" />
666- <ColumnDefinition Width =" 2*" />
667- <ColumnDefinition Width =" 1*" />
668- </Grid .ColumnDefinitions>
669- <controls : ProgressIndicator Grid.Column=" 1" Grid.ColumnSpan=" 3"
670- Style =" {StaticResource KeySelectionProgressStyle}" />
671- <Viewbox >
672- <Viewbox .Style>
673- <Style TargetType =" {x:Type Viewbox}" >
674- <Setter Property =" Grid.Column" Value =" 1" />
675- <Setter Property =" Grid.ColumnSpan" Value =" 3" />
676- <Style .Triggers>
677- <DataTrigger Binding =" {Binding Path=HasSymbol, RelativeSource={RelativeSource AncestorType={x:Type controls:Key}}}" Value =" False" >
678- <Setter Property =" Grid.Column" Value =" 2" />
679- <Setter Property =" Grid.ColumnSpan" Value =" 1" />
680- </DataTrigger >
681- </Style .Triggers>
682- </Style >
683- </Viewbox .Style>
684- <Grid >
685- <Grid .ColumnDefinitions>
686- <ColumnDefinition SharedSizeGroup =" {Binding Path=SharedSizeGroup, RelativeSource={RelativeSource AncestorType={x:Type controls:Key}}}" />
687- </Grid .ColumnDefinitions>
688- <TextBlock Style =" {StaticResource KeyTextStyle}" />
689- <Path Style =" {StaticResource KeySymbolStyle}" Width =" 64" Height =" 64" VerticalAlignment =" Center" />
690- </Grid >
691- </Viewbox >
692- </Grid >
693- </ContentControl >
694- <Path Grid.Row=" 2" Style =" {StaticResource KeyLockIconStyle}" />
695- </Grid >
655+ <Border Style =" {StaticResource KeyDownStyle}" >
656+ <Grid >
657+ <Grid .RowDefinitions>
658+ <RowDefinition Height =" 1*" />
659+ <RowDefinition Height =" 2*" />
660+ <RowDefinition Height =" 1*" />
661+ </Grid .RowDefinitions>
662+ <ContentControl Grid.RowSpan=" 3" >
663+ <!-- Enforce size limits of one key high/wide using the Span info on the key-->
664+ <ContentControl .MaxWidth>
665+ <MultiBinding Converter =" {StaticResource LengthDividedBySpan}" >
666+ <MultiBinding .Bindings>
667+ <Binding Path =" ActualWidth" RelativeSource =" {RelativeSource AncestorType={x:Type Grid}}" />
668+ <Binding Path =" WidthSpan" RelativeSource =" {RelativeSource AncestorType={x:Type controls:Key}}" />
669+ </MultiBinding .Bindings>
670+ </MultiBinding >
671+ </ContentControl .MaxWidth>
672+ <ContentControl .MaxHeight>
673+ <MultiBinding Converter =" {StaticResource LengthDividedBySpan}" >
674+ <MultiBinding .Bindings>
675+ <Binding Path =" ActualHeight" RelativeSource =" {RelativeSource AncestorType={x:Type Grid}}" />
676+ <Binding Path =" HeightSpan" RelativeSource =" {RelativeSource AncestorType={x:Type controls:Key}}" />
677+ </MultiBinding .Bindings>
678+ </MultiBinding >
679+ </ContentControl .MaxHeight>
680+ <Grid >
681+ <Grid .ColumnDefinitions>
682+ <ColumnDefinition Width =" 1*" />
683+ <ColumnDefinition Width =" 2*" />
684+ <ColumnDefinition Width =" 8*" />
685+ <ColumnDefinition Width =" 2*" />
686+ <ColumnDefinition Width =" 1*" />
687+ </Grid .ColumnDefinitions>
688+ <controls : ProgressIndicator Grid.Column=" 1" Grid.ColumnSpan=" 3"
689+ Style =" {StaticResource KeySelectionProgressStyle}" />
690+ <Viewbox >
691+ <Viewbox .Style>
692+ <Style TargetType =" {x:Type Viewbox}" >
693+ <Setter Property =" Grid.Column" Value =" 1" />
694+ <Setter Property =" Grid.ColumnSpan" Value =" 3" />
695+ <Style .Triggers>
696+ <DataTrigger Binding =" {Binding Path=HasSymbol, RelativeSource={RelativeSource AncestorType={x:Type controls:Key}}}" Value =" False" >
697+ <Setter Property =" Grid.Column" Value =" 2" />
698+ <Setter Property =" Grid.ColumnSpan" Value =" 1" />
699+ </DataTrigger >
700+ </Style .Triggers>
701+ </Style >
702+ </Viewbox .Style>
703+ <Grid >
704+ <Grid .ColumnDefinitions>
705+ <ColumnDefinition SharedSizeGroup =" {Binding Path=SharedSizeGroup, RelativeSource={RelativeSource AncestorType={x:Type controls:Key}}}" />
706+ </Grid .ColumnDefinitions>
707+ <TextBlock Style =" {StaticResource KeyTextStyle}" />
708+ <Path Style =" {StaticResource KeySymbolStyle}" Width =" 64" Height =" 64" VerticalAlignment =" Center" />
709+ </Grid >
710+ </Viewbox >
711+ </Grid >
712+ </ContentControl >
713+ <Path Grid.Row=" 2" Style =" {StaticResource KeyLockIconStyle}" />
714+ </Grid >
715+ </Border >
696716 </Border >
697717 <Border Style =" {StaticResource CurrentKeyBorderHighlightStyle}" />
698718 <!-- Custom border style for multiKey-->
0 commit comments