diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common')
3 files changed, 262 insertions, 61 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml index 0bf472a2e..70c9cb3c4 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml @@ -6,7 +6,8 @@ xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:mahApps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:sys="clr-namespace:System;assembly=mscorlib" - xmlns:local="clr-namespace:Tango.MachineStudio.Common.Resources"> + xmlns:local="clr-namespace:Tango.MachineStudio.Common.Resources" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"> <ResourceDictionary.MergedDictionaries> <!--WPF Extended Toolkit--> @@ -55,31 +56,10 @@ <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.Slider.xaml"> </ResourceDictionary> <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.ProgressBar.xaml"/> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ComboBox.xaml" /> <ResourceDictionary Source="GradientOffsetSlider.xaml" /> - <!--<local:SharedResourceDictionary Source="pack://application:,,,/Tango.MachineStudio.Common;component/Themes/LightThemeColors.xaml"/>--> - - <!--MahApps Brushes--> - <!--<ResourceDictionary>--> - <!--<SolidColorBrush x:Key="HighlightBrush" Color="{DynamicResource Primary700}" /> - <SolidColorBrush x:Key="AccentColorBrush" Color="{DynamicResource Primary500}" /> - <SolidColorBrush x:Key="AccentColorBrush2" Color="{DynamicResource Primary400}" /> - <SolidColorBrush x:Key="AccentColorBrush3" Color="{DynamicResource Primary300}" /> - <SolidColorBrush x:Key="AccentColorBrush4" Color="{DynamicResource Primary200}" /> - <SolidColorBrush x:Key="WindowTitleColorBrush" Color="{DynamicResource Primary700}" /> - <SolidColorBrush x:Key="AccentSelectedColorBrush" Color="{DynamicResource Primary500Foreground}" /> - <LinearGradientBrush x:Key="ProgressBrush" EndPoint="0.001,0.5" StartPoint="1.002,0.5"> - <GradientStop Color="{DynamicResource Primary700}" Offset="0" /> - <GradientStop Color="{DynamicResource Primary300}" Offset="1" /> - </LinearGradientBrush> - <SolidColorBrush x:Key="CheckmarkFill" Color="{DynamicResource Primary500}" /> - <SolidColorBrush x:Key="RightArrowFill" Color="{DynamicResource Primary500}" /> - <SolidColorBrush x:Key="IdealForegroundColorBrush" Color="{DynamicResource Primary500Foreground}" /> - <SolidColorBrush x:Key="IdealForegroundDisabledBrush" Color="{DynamicResource Primary500}" Opacity="0.4" />--> - <!--</ResourceDictionary>--> - - <!--Fonts--> <ResourceDictionary> <FontFamily x:Key="digital-7">../Fonts/#digital-7</FontFamily> @@ -90,6 +70,15 @@ <BooleanToVisibilityConverter x:Key="BoolToVisConverter" /> <converters:TextFieldHintVisibilityConverter x:Key="TextFieldHintVisibilityConverter" /> + <converters:MathConverter x:Key="MathAddConverter" Operation="Add" /> + <converters:BrushRoundConverter x:Key="BrushRoundConverter" /> + <converters:BooleanToVisibilityConverter x:Key="InverseBoolToVisConverter" TrueValue="Collapsed" FalseValue="Visible"/> + + <sys:Double x:Key="PopupContentPresenterExtend">4</sys:Double> + <sys:Double x:Key="PopupTopBottomMargin">8</sys:Double> + <sys:Double x:Key="PopupLeftRightMargin">16</sys:Double> + <sys:Boolean x:Key="TrueValue">True</sys:Boolean> + <sys:Boolean x:Key="FalseValue">False</sys:Boolean> <Style TargetType="editors:AutoCompleteTextBox" > <Setter Property="Focusable" Value="True" /> @@ -209,43 +198,6 @@ <sys:Double x:Key="MiniFontSize">12</sys:Double> <sys:Double x:Key="TinyFontSize">9</sys:Double> - <!--Colors--><!-- - <Color x:Key="borderColor">Silver</Color> - <Color x:Key="graphGridLinesColor">#FF464646</Color> - <Color x:Key="graphsMarkerColor">Gray</Color> - <Color x:Key="materialColor">#03A9F4</Color> - - --><!--Brushes--><!-- - <SolidColorBrush x:Key="borderBrush" Color="{StaticResource borderColor}"></SolidColorBrush> - <SolidColorBrush x:Key="graphGridLinesBrush" Color="{StaticResource graphGridLinesColor}"></SolidColorBrush> - <SolidColorBrush x:Key="BlackBrush" Color="#545454"></SolidColorBrush> - - <SolidColorBrush x:Key="graphGridLinesLightBrush" Color="{StaticResource graphGridLinesColor}"></SolidColorBrush> - <SolidColorBrush x:Key="graphGridLinesDarkBrush" Color="#FF2E2E2E"></SolidColorBrush> - - <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphBackgroundLight"> - <GradientStop Color="White"/> - <GradientStop Color="#FFE9E9E9" Offset="1"/> - </LinearGradientBrush> - - <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphBackgroundDark"> - <GradientStop Color="Black"/> - <GradientStop Color="#FF333333" Offset="1"/> - </LinearGradientBrush> - - <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphBackground"> - <GradientStop Color="#121212"/> - <GradientStop Color="#FF333333" Offset="1"/> - </LinearGradientBrush>--> - - - - <!--<SolidColorBrush Color="{DynamicResource WhiteBrush100}" x:Key="topBarBackgroundBrush"></SolidColorBrush>--> - <!--Brushes--> - - - - <!--Graph Ticks Template--> <DataTemplate x:Key="graphTicksTemplate"> <Ellipse Width="3" Height="3" Margin="0 0 0 0" Fill="{StaticResource AccentColorBrush}"></Ellipse> @@ -574,6 +526,254 @@ </Setter.Value> </Setter> </Style> + + <ControlTemplate x:Key="TransparentPopupContentDownTemplate" TargetType="ContentControl"> + <Grid MinWidth="{Binding ElementName=templateRoot, Path=ActualWidth, Converter={StaticResource MathAddConverter}, ConverterParameter=32}" + Margin="6" Background="Transparent"> + <Grid.RowDefinitions> + <RowDefinition Height="*" /> + </Grid.RowDefinitions> + <Border Background="Transparent" + BorderBrush="{DynamicResource MaterialDesignShadowBrush}" + BorderThickness="1" + CornerRadius="2"> + <Border.Effect> + <BlurEffect Radius="6"/> + </Border.Effect> + </Border> + <Grid Margin="1" + SnapsToDevicePixels="True"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="*"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <Border Grid.Row="0" + CornerRadius="2 2 0 0" + Background="{DynamicResource ComboBox.Floating.Background}" + Height="{StaticResource PopupTopBottomMargin}"/> + + <Grid Grid.Row="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + <Border Grid.Column="0" + Width="{StaticResource PopupLeftRightMargin}" + Background="{DynamicResource ComboBox.Floating.Background}" + /> + <Grid Grid.Column="1" + Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type materialDesign:ComboBoxPopup}}, Path=VisiblePlacementWidth}" + Height="{Binding ElementName=templateRoot, Path=ActualHeight}"/> + <Border Grid.Column="2" + MinWidth="{StaticResource PopupLeftRightMargin}" + Background="{DynamicResource ComboBox.Floating.Background}" + /> + </Grid> + + <Border Grid.Row="2" + Background="{DynamicResource ComboBox.Floating.Background}" + Height="{StaticResource PopupContentPresenterExtend}"/> + + <ContentPresenter Grid.Row="3"/> + + <Border Grid.Row="4" + CornerRadius="0 0 2 2" + Height="{StaticResource PopupTopBottomMargin}" + Background="{DynamicResource ComboBox.Floating.Background}" /> + </Grid> + </Grid> + </ControlTemplate> + + <Style x:Key="TransparentComboBoxStyle" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource MaterialDesignComboBox}"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ComboBox}" > + <Grid x:Name="templateRoot" + Background="Transparent" + SnapsToDevicePixels="True"> + <Grid x:Name="InnerRoot"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="0" MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" /> + </Grid.ColumnDefinitions> + <ToggleButton x:Name="toggleButton" + Grid.ColumnSpan="2" + Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" + Style="{StaticResource MaterialDesignComboBoxToggleButton}"/> + <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" + VerticalAlignment="{TemplateBinding VerticalContentAlignment}" + Margin="{TemplateBinding Padding}" + SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" + UseLayoutRounding="{TemplateBinding UseLayoutRounding}"> + <Grid x:Name="InputRoot" + HorizontalAlignment="Left"> + <ContentPresenter x:Name="contentPresenter" + Content="{TemplateBinding SelectionBoxItem}" + ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" + ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" + ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" + IsHitTestVisible="False" /> + <TextBox x:Name="PART_EditableTextBox" + IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" + HorizontalAlignment="Left" + HorizontalContentAlignment="Stretch" + Style="{StaticResource MaterialDesignComboBoxEditableTextBox}" + CaretBrush="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderBrush}" + Visibility="Collapsed" /> + + <materialDesign:SmartHint x:Name="Hint" + HintProxy="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:HintProxyFabricConverter.Instance}}" + FontSize="{TemplateBinding FontSize}" + SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" + UseLayoutRounding="{TemplateBinding UseLayoutRounding}" + UseFloating="{Binding Path=(materialDesign:HintAssist.IsFloating), RelativeSource={RelativeSource TemplatedParent}}" + HintOpacity="{Binding Path=(materialDesign:HintAssist.HintOpacity), RelativeSource={RelativeSource TemplatedParent}}" + Hint="{TemplateBinding materialDesign:HintAssist.Hint}" /> + </Grid> + </Grid> + <Line x:Name="DashedLine" Grid.ColumnSpan="2" VerticalAlignment="Bottom" + Visibility="{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource InverseBoolToVisConverter}}" + StrokeThickness="1.25" StrokeDashArray="1,2.5" StrokeDashCap="Round" + X1="0" X2="{Binding ActualWidth, ElementName=toggleButton}" Y1="0" Y2="0" + Stroke="{TemplateBinding BorderBrush}" Opacity="0.56" /> + <materialDesign:Underline x:Name="Underline" + Grid.ColumnSpan="2" + IsActive="{Binding ElementName=PART_EditableTextBox, Path=IsKeyboardFocused}" + Visibility="{Binding Path=(materialDesign:TextFieldAssist.DecorationVisibility), RelativeSource={RelativeSource TemplatedParent}}"/> + + <materialDesign:ComboBoxPopup x:Name="PART_Popup" + + AllowsTransparency="true" + Focusable="False" + HorizontalOffset="-11.5" + IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" + PlacementTarget="{Binding ElementName=templateRoot}" + SnapsToDevicePixels="True" + UseLayoutRounding="True" + Placement="Custom" + PopupAnimation="Fade" + VerticalOffset="0" + DefaultVerticalOffset="5" + DownVerticalOffset="-15.5" + UpVerticalOffset="15" + ClassicMode="{Binding Path=(materialDesign:ComboBoxAssist.ClassicMode), RelativeSource={RelativeSource TemplatedParent}}" + UpContentTemplate="{StaticResource PopupContentUpTemplate}" + DownContentTemplate="{StaticResource TransparentPopupContentDownTemplate}" + ClassicContentTemplate="{StaticResource PopupContentClassicTemplate}"> + + <ContentControl> + <ScrollViewer MaxHeight="{TemplateBinding MaxDropDownHeight}" + Background="{DynamicResource ComboBox.Floating.Background}"> + <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" /> + </ScrollViewer> + </ContentControl> + </materialDesign:ComboBoxPopup> + </Grid> + </Grid> + <ControlTemplate.Triggers> + <Trigger SourceName="PART_Popup" Property="PopupPlacement" Value="{x:Static materialDesign:ComboBoxPopupPlacement.Classic}"> + <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignComboBoxItemStyle}" /> + </Trigger> + <Trigger SourceName="PART_Popup" Property="IsOpen" Value="True"> + <Setter Property="Background" TargetName="templateRoot" Value="{DynamicResource ComboBox.Floating.Background}" /> + </Trigger> + <Trigger Property="IsEnabled" Value="False"> + <Setter TargetName="templateRoot" Property="Opacity" Value="0.56"/> + <Setter TargetName="toggleButton" Property="BorderBrush" Value="Transparent"/> + </Trigger> + <Trigger Property="IsEditable" Value="True"> + <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" /> + <Setter TargetName="Underline" Property="Visibility" Value="{Binding Path=(materialDesign:TextFieldAssist.DecorationVisibility), RelativeSource={RelativeSource TemplatedParent}}" /> + <Setter TargetName="contentPresenter" Property="Visibility" Value="Collapsed" /> + </Trigger> + <Trigger Property="materialDesign:HintAssist.IsFloating" Value="True"> + <Setter TargetName="InnerRoot" Property="Margin" Value="0 11.5 0 0" /> + </Trigger> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="IsEditable" Value="False"/> + <Condition Property="IsDropDownOpen" Value="True"/> + </MultiTrigger.Conditions> + <Setter TargetName="Underline" Property="Visibility" Value="Hidden"/> + <Setter TargetName="toggleButton" Property="BorderBrush" Value="Transparent"/> + </MultiTrigger> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition SourceName="Hint" Property="IsContentNullOrEmpty" Value="False" /> + <Condition Property="materialDesign:HintAssist.IsFloating" Value="True" /> + <Condition Property="IsKeyboardFocusWithin" Value="True" /> + </MultiTrigger.Conditions> + <Setter TargetName="Hint" Property="Foreground" Value="{DynamicResource PrimaryHueMidBrush}" /> + <Setter TargetName="Hint" Property="HintOpacity" Value="1" /> + </MultiTrigger> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="materialDesign:HintAssist.IsFloating" Value="True" /> + <!--<Condition SourceName="Hint" Property="IsHintInFloatingPosition" Value="True" />--> + <Condition Property="IsKeyboardFocusWithin" Value="True" /> + </MultiTrigger.Conditions> + <Setter TargetName="Hint" Property="Foreground" Value="{DynamicResource PrimaryHueMidBrush}" /> + <Setter TargetName="Hint" Property="HintOpacity" Value="1" /> + </MultiTrigger> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition SourceName="Hint" Property="IsContentNullOrEmpty" Value="False" /> + <Condition SourceName="PART_EditableTextBox" Property="IsKeyboardFocused" Value="True" /> + </MultiTrigger.Conditions> + <Setter TargetName="Hint" Property="Foreground" Value="{DynamicResource PrimaryHueMidBrush}" /> + <Setter TargetName="Hint" Property="HintOpacity" Value="1" /> + </MultiTrigger> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition SourceName="Hint" Property="IsContentNullOrEmpty" Value="False" /> + <Condition Property="IsDropDownOpen" Value="True" /> + </MultiTrigger.Conditions> + <Setter TargetName="Hint" Property="Foreground" Value="{DynamicResource PrimaryHueMidBrush}" /> + <Setter TargetName="Hint" Property="HintOpacity" Value="1" /> + </MultiTrigger> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="IsGrouping" Value="true" /> + <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" /> + </MultiTrigger.Conditions> + <Setter Property="ScrollViewer.CanContentScroll" Value="false" /> + </MultiTrigger> + <Trigger Property="IsKeyboardFocused" Value="true"> + <Setter TargetName="Underline" Property="IsActive" Value="True"/> + </Trigger> + <Trigger Property="Validation.HasError" Value="true"> + <Setter Property="BorderBrush" Value="{DynamicResource ValidationErrorBrush}"/> + <Setter TargetName="Underline" Property="Background" Value="{DynamicResource ValidationErrorBrush}"/> + </Trigger> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="IsMouseOver" Value="true" /> + <Condition Property="Validation.HasError" Value="true" /> + </MultiTrigger.Conditions> + <Setter Property="BorderBrush" Value="{DynamicResource ValidationErrorBrush}"/> + <Setter TargetName="Underline" Property="Background" Value="{DynamicResource ValidationErrorBrush}"/> + </MultiTrigger> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="IsMouseOver" Value="true" /> + <Condition Property="Validation.HasError" Value="false" /> + </MultiTrigger.Conditions> + <Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueMidBrush}"/> + <Setter TargetName="Underline" Property="Background" Value="{DynamicResource PrimaryHueMidBrush}"/> + </MultiTrigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> </ResourceDictionary> </ResourceDictionary.MergedDictionaries> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Themes/DarkThemeColors.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Themes/DarkThemeColors.xaml index ad8f0f09b..8dd4efc32 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Themes/DarkThemeColors.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Themes/DarkThemeColors.xaml @@ -146,7 +146,7 @@ <SolidColorBrush x:Key="Hexagon.ForegroundBrush" Color="White"/> <SolidColorBrush x:Key="AutoCompleteTextBox.Popup.Background" Color="#383838"></SolidColorBrush> <SolidColorBrush x:Key="AutoCompleteTextBox.Popup.BorderBrush" Color="#BBBBBB"></SolidColorBrush> - <SolidColorBrush x:Key="ComboBox.Popup.Background" Color="red"></SolidColorBrush> + <SolidColorBrush x:Key="ComboBox.Floating.Background" Color="#383838"></SolidColorBrush> <!--material design colors--> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Themes/LightThemeColors.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Themes/LightThemeColors.xaml index 25f72f8d4..0f5727e5b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Themes/LightThemeColors.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Themes/LightThemeColors.xaml @@ -124,6 +124,7 @@ <SolidColorBrush x:Key="Hexagon.ForegroundBrush" Color="black"/> <SolidColorBrush x:Key="AutoCompleteTextBox.Popup.Background" Color="White"></SolidColorBrush> <SolidColorBrush x:Key="AutoCompleteTextBox.Popup.BorderBrush" Color="#BDBDBD"></SolidColorBrush> + <SolidColorBrush x:Key="ComboBox.Floating.Background" Color="White"></SolidColorBrush> <!--material design colors--> <!--<SolidColorBrush x:Key="HighlightBrush" Color="#FF0288d1" /> |
