A Swiss Army knife for developers.
C# blazorcross-platformcsharpdesktopdesktop-appdesktop-applicationdeveloper-toolsextensiblefluentfluent-designlinuxmacosmicasyntax-highlightingtypescriptwindowswindows-10windows-11winui
Added expandable setting control + settings UI
Etienne Baudoux4b2306f28978
diff --git a/src/dev/impl/DevTools.Common/DevTools.Common.csproj b/src/dev/impl/DevTools.Common/DevTools.Common.csprojindex 72bf1cdf5..d73df37f6 100644--- a/src/dev/impl/DevTools.Common/DevTools.Common.csproj+++ b/src/dev/impl/DevTools.Common/DevTools.Common.csproj@@ -81,9 +81,16 @@<DesignTime>True</DesignTime></Compile><Compile Include="UI\Controls\CustomPathIcon.cs" />+ <Compile Include="UI\Controls\ExpandableSettingControl.xaml.cs">+ <DependentUpon>ExpandableSettingControl.xaml</DependentUpon>+ </Compile>+ <Compile Include="UI\Controls\ExpandableSettingHeaderControl.xaml.cs">+ <DependentUpon>ExpandableSettingHeaderControl.xaml</DependentUpon>+ </Compile><Compile Include="UI\Converters\BooleanToVisibilityConverter.cs" /><Compile Include="UI\Converters\DoubleToGridLengthConverter.cs" /><Compile Include="UI\Converters\InvertedBooleanConverter.cs" />+ <Compile Include="UI\Converters\NullToBooleanConverter.cs" /><Compile Include="UI\Extensions\HighlighterExtension.cs" /><Content Include="Assets\Icons\Idea.svg" /><Content Include="LanguageManager.tt">@@ -95,6 +102,7 @@<ItemGroup><PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="$(NuGet_MicrosoftNETCoreUniversalWindowsPlatform)" /><PackageReference Include="Microsoft.Toolkit.Mvvm" Version="$(NuGet_MicrosoftToolkitMvvm)" />+ <PackageReference Include="Microsoft.UI.Xaml" Version="$(NuGet_MicrosoftUIXaml)" /></ItemGroup><ItemGroup><Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />@@ -111,6 +119,14 @@<Generator>MSBuild:Compile</Generator><SubType>Designer</SubType></Page>+ <Page Include="UI\Controls\ExpandableSettingControl.xaml">+ <SubType>Designer</SubType>+ <Generator>MSBuild:Compile</Generator>+ </Page>+ <Page Include="UI\Controls\ExpandableSettingHeaderControl.xaml">+ <SubType>Designer</SubType>+ <Generator>MSBuild:Compile</Generator>+ </Page></ItemGroup><ItemGroup><PRIResource Include="Strings\en\Base64EncoderDecoder.resw" />diff --git a/src/dev/impl/DevTools.Common/Themes/Custom.xaml b/src/dev/impl/DevTools.Common/Themes/Custom.xamlindex 38e44d6a4..f31dc2552 100644--- a/src/dev/impl/DevTools.Common/Themes/Custom.xaml+++ b/src/dev/impl/DevTools.Common/Themes/Custom.xaml@@ -10,4 +10,599 @@<x:String x:Key="Base64EncoderDecoderToolProvider">M 0.008 0.008 L 0.008 31.992 L 31.992 31.992 L 31.992 0.008 Z M 2.916 2.916 L 29.084 2.916 L 29.084 29.084 L 2.916 29.084 Z M 11.957 10.094 L 8.777 13.774 C 7.823 14.87 7.276 16.273 7.276 17.727 L 7.276 18.18 C 7.276 20.169 8.924 21.816 10.912 21.816 L 12.366 21.816 C 14.353 21.816 16 20.169 16 18.18 C 16 16.193 14.353 14.546 12.366 14.546 L 11.957 14.546 L 14.137 12.002 Z M 21.816 10.184 L 21.816 14.546 L 20.362 14.546 L 20.362 10.231 L 17.454 10.231 L 17.454 17.454 L 21.816 17.454 L 21.816 21.816 L 24.722 21.816 L 24.722 10.184 Z M 10.276 17.454 L 12.366 17.454 C 12.781 17.454 13.092 17.766 13.092 18.18 C 13.092 18.595 12.781 18.908 12.366 18.908 L 10.912 18.908 C 10.497 18.908 10.184 18.595 10.184 18.18 L 10.184 17.727 C 10.184 17.629 10.264 17.55 10.276 17.454 Z</x:String><x:String x:Key="JsonFormatterToolProvider">M 9.5703125 4 C 5.9553125 4 4.4385 5.3040312 4.4375 8.4570312 L 4.4375 10.648438 C 4.4375 12.498437 3.9412656 13.115234 2.4472656 13.115234 L 2.4472656 16.398438 C 3.9402656 16.398437 4.4375 17.014563 4.4375 18.851562 L 4.4375 21.435547 C 4.4375 24.660547 5.9673125 26 9.5703125 26 L 10.816406 26 L 10.816406 23.404297 L 10.283203 23.404297 C 8.3622031 23.404297 7.7460938 22.835328 7.7460938 20.986328 L 7.7460938 17.904297 C 7.7460938 16.091297 6.8912969 15.024141 5.2792969 14.869141 L 5.2792969 14.65625 C 6.9632969 14.50225 7.7460938 13.578656 7.7460938 11.847656 L 7.7460938 9.0371094 C 7.7460938 7.1761094 8.3512031 6.6074219 10.283203 6.6074219 L 10.816406 6.6074219 L 10.816406 4 L 9.5703125 4 z M 19.183594 4 L 19.183594 6.6074219 L 19.716797 6.6074219 C 21.648797 6.6074219 22.253906 7.1761094 22.253906 9.0371094 L 22.253906 11.847656 C 22.253906 13.577656 23.037703 14.50225 24.720703 14.65625 L 24.720703 14.871094 C 23.107703 15.025094 22.253906 16.090297 22.253906 17.904297 L 22.253906 20.986328 C 22.253906 22.835328 21.636797 23.404297 19.716797 23.404297 L 19.183594 23.404297 L 19.183594 26.001953 L 20.429688 26.001953 C 24.033688 26.001953 25.5625 24.6615 25.5625 21.4375 L 25.5625 18.853516 C 25.5625 17.015516 26.058734 16.398438 27.552734 16.398438 L 27.552734 13.115234 C 26.059734 13.115234 25.5625 12.499391 25.5625 10.650391 L 25.5625 8.4570312 C 25.5625 5.3040312 24.044687 4 20.429688 4 L 19.183594 4 z</x:String>++ <!-- From https://github.com/morning4coffe-dev/storylines -->+ <Style x:Key="RightAlignedToggleSwitchStyle" TargetType="ToggleSwitch">+ <Setter Property="Foreground" Value="{ThemeResource ToggleSwitchContentForeground}" />+ <Setter Property="HorizontalAlignment" Value="Left" />+ <Setter Property="VerticalAlignment" Value="Center" />+ <Setter Property="HorizontalContentAlignment" Value="Left" />+ <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />+ <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />+ <Setter Property="ManipulationMode" Value="System,TranslateX" />+ <Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />+ <Setter Property="MinWidth" Value="0" />+ <Setter Property="FocusVisualMargin" Value="-7,-3,-7,-3" />+ <Setter Property="CornerRadius" Value="{StaticResource ControlCornerRadius}" />+ <Setter Property="Template">+ <Setter.Value>+ <ControlTemplate TargetType="ToggleSwitch">+ <Grid+ Background="{TemplateBinding Background}"+ BorderBrush="{TemplateBinding BorderBrush}"+ BorderThickness="{TemplateBinding BorderThickness}"+ CornerRadius="{TemplateBinding CornerRadius}">+ <Grid.RowDefinitions>+ <RowDefinition Height="Auto" />+ <RowDefinition Height="*" />+ </Grid.RowDefinitions>++ <ContentPresenter+ x:Name="HeaderContentPresenter"+ Grid.Row="0"+ Margin="{ThemeResource ToggleSwitchTopHeaderMargin}"+ VerticalAlignment="Top"+ x:DeferLoadStrategy="Lazy"+ AutomationProperties.AccessibilityView="Raw"+ Content="{TemplateBinding Header}"+ ContentTemplate="{TemplateBinding HeaderTemplate}"+ Foreground="{ThemeResource ToggleSwitchHeaderForeground}"+ IsHitTestVisible="False"+ TextWrapping="Wrap"+ Visibility="Collapsed" />+ <Grid+ Grid.Row="1"+ HorizontalAlignment="Right"+ VerticalAlignment="Top">++ <Grid.RowDefinitions>+ <RowDefinition Height="{ThemeResource ToggleSwitchPreContentMargin}" />+ <RowDefinition Height="Auto" />+ <RowDefinition Height="{ThemeResource ToggleSwitchPostContentMargin}" />+ </Grid.RowDefinitions>++ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="12" MaxWidth="12" />+ <ColumnDefinition Width="Auto" />+ </Grid.ColumnDefinitions>+ <Grid+ x:Name="SwitchAreaGrid"+ Grid.RowSpan="3"+ Grid.ColumnSpan="3"+ Margin="0,5"+ Background="{ThemeResource ToggleSwitchContainerBackground}"+ Control.IsTemplateFocusTarget="True"+ CornerRadius="{TemplateBinding CornerRadius}" />+ <ContentPresenter+ x:Name="OffContentPresenter"+ Grid.RowSpan="3"+ Grid.Column="0"+ HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"+ VerticalAlignment="{TemplateBinding VerticalContentAlignment}"+ AutomationProperties.AccessibilityView="Raw"+ Content="{TemplateBinding OffContent}"+ ContentTemplate="{TemplateBinding OffContentTemplate}"+ Foreground="{TemplateBinding Foreground}"+ IsHitTestVisible="False"+ Opacity="0" />+ <ContentPresenter+ x:Name="OnContentPresenter"+ Grid.RowSpan="3"+ Grid.Column="0"+ HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"+ VerticalAlignment="{TemplateBinding VerticalContentAlignment}"+ AutomationProperties.AccessibilityView="Raw"+ Content="{TemplateBinding OnContent}"+ ContentTemplate="{TemplateBinding OnContentTemplate}"+ Foreground="{TemplateBinding Foreground}"+ IsHitTestVisible="False"+ Opacity="0" />+ <Rectangle+ x:Name="OuterBorder"+ Grid.Row="1"+ Grid.Column="2"+ Width="40"+ Height="20"+ Fill="{ThemeResource ToggleSwitchFillOff}"+ RadiusX="10"+ RadiusY="10"+ Stroke="{ThemeResource ToggleSwitchStrokeOff}"+ StrokeThickness="{ThemeResource ToggleSwitchOuterBorderStrokeThickness}" />+ <Rectangle+ x:Name="SwitchKnobBounds"+ Grid.Row="1"+ Grid.Column="2"+ Width="40"+ Height="20"+ Fill="{ThemeResource ToggleSwitchFillOn}"+ Opacity="0"+ RadiusX="10"+ RadiusY="10"+ Stroke="{ThemeResource ToggleSwitchStrokeOn}"+ StrokeThickness="{ThemeResource ToggleSwitchOnStrokeThickness}" />+ <Grid+ x:Name="SwitchKnob"+ Grid.Row="1"+ Grid.Column="2"+ Width="20"+ Height="20"+ HorizontalAlignment="Left">+ <Border+ x:Name="SwitchKnobOn"+ Width="12"+ Height="12"+ Margin="0,0,1,0"+ HorizontalAlignment="Center"+ Background="{ThemeResource ToggleSwitchKnobFillOn}"+ BackgroundSizing="OuterBorderEdge"+ BorderBrush="{ThemeResource ToggleSwitchKnobStrokeOn}"+ CornerRadius="7"+ Opacity="0"+ RenderTransformOrigin="0.5, 0.5">+ <Border.RenderTransform>+ <CompositeTransform />+ </Border.RenderTransform>+ </Border>+ <Rectangle+ x:Name="SwitchKnobOff"+ Width="12"+ Height="12"+ Margin="-1,0,0,0"+ HorizontalAlignment="Center"+ Fill="{ThemeResource ToggleSwitchKnobFillOff}"+ RadiusX="7"+ RadiusY="7"+ RenderTransformOrigin="0.5, 0.5">+ <Rectangle.RenderTransform>+ <CompositeTransform />+ </Rectangle.RenderTransform>+ </Rectangle>+ <Grid.RenderTransform>+ <TranslateTransform x:Name="KnobTranslateTransform" />+ </Grid.RenderTransform>+ </Grid>+ <Thumb+ x:Name="SwitchThumb"+ Grid.RowSpan="3"+ Grid.ColumnSpan="3"+ AutomationProperties.AccessibilityView="Raw">+ <Thumb.Template>+ <ControlTemplate TargetType="Thumb">+ <Rectangle Fill="Transparent" />+ </ControlTemplate>+ </Thumb.Template>+ </Thumb>++ </Grid>++ <VisualStateManager.VisualStateGroups>+ <VisualStateGroup x:Name="CommonStates">+ <VisualState x:Name="Normal">+ <Storyboard>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="Stroke">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchStrokeOff}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="Fill">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchFillOff}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Fill">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOff}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Background">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOn}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Fill">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchFillOn}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Stroke">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchStrokeOn}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchAreaGrid" Storyboard.TargetProperty="Background">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchContainerBackground}" />+ </ObjectAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOn"+ Storyboard.TargetProperty="Width">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlFasterAnimationDuration}"+ Value="12" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOn"+ Storyboard.TargetProperty="Height">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlFasterAnimationDuration}"+ Value="12" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOff"+ Storyboard.TargetProperty="Width">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlFasterAnimationDuration}"+ Value="12" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOff"+ Storyboard.TargetProperty="Height">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlFasterAnimationDuration}"+ Value="12" />+ </DoubleAnimationUsingKeyFrames>+ </Storyboard>+ </VisualState>+ <VisualState x:Name="PointerOver">+ <Storyboard>+ <ColorAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">+ <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchStrokeOffPointerOver}" />+ </ColorAnimationUsingKeyFrames>+ <ColorAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">+ <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchFillOffPointerOver}" />+ </ColorAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Fill">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOffPointerOver}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Background">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOnPointerOver}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Fill">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchFillOnPointerOver}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Stroke">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchStrokeOnPointerOver}" />+ </ObjectAnimationUsingKeyFrames>+ <ColorAnimationUsingKeyFrames Storyboard.TargetName="SwitchAreaGrid" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">+ <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchContainerBackgroundPointerOver}" />+ </ColorAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOn"+ Storyboard.TargetProperty="Width">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlFasterAnimationDuration}"+ Value="14" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOn"+ Storyboard.TargetProperty="Height">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlFasterAnimationDuration}"+ Value="14" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOff"+ Storyboard.TargetProperty="Width">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlFasterAnimationDuration}"+ Value="14" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOff"+ Storyboard.TargetProperty="Height">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlFasterAnimationDuration}"+ Value="14" />+ </DoubleAnimationUsingKeyFrames>+ </Storyboard>+ </VisualState>+ <VisualState x:Name="Pressed">++ <VisualState.Setters>+ <Setter Target="SwitchKnobOn.HorizontalAlignment" Value="Right" />+ <Setter Target="SwitchKnobOn.Margin" Value="0,0,3,0" />+ <Setter Target="SwitchKnobOff.HorizontalAlignment" Value="Left" />+ <Setter Target="SwitchKnobOff.Margin" Value="3,0,0,0" />+ </VisualState.Setters>++ <Storyboard>+ <ColorAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">+ <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchStrokeOffPressed}" />+ </ColorAnimationUsingKeyFrames>+ <ColorAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">+ <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchFillOffPressed}" />+ </ColorAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Fill">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchFillOnPressed}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Stroke">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchStrokeOnPressed}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Fill">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOffPressed}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Background">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOnPressed}" />+ </ObjectAnimationUsingKeyFrames>+ <ColorAnimationUsingKeyFrames Storyboard.TargetName="SwitchAreaGrid" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">+ <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchContainerBackgroundPressed}" />+ </ColorAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOn"+ Storyboard.TargetProperty="Width">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlFasterAnimationDuration}"+ Value="17" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOn"+ Storyboard.TargetProperty="Height">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlFasterAnimationDuration}"+ Value="14" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOff"+ Storyboard.TargetProperty="Width">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlFasterAnimationDuration}"+ Value="17" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOff"+ Storyboard.TargetProperty="Height">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlFasterAnimationDuration}"+ Value="14" />+ </DoubleAnimationUsingKeyFrames>+ </Storyboard>+ </VisualState>+ <VisualState x:Name="Disabled">+ <Storyboard>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderContentPresenter" Storyboard.TargetProperty="Foreground">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchHeaderForegroundDisabled}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OffContentPresenter" Storyboard.TargetProperty="Foreground">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchContentForegroundDisabled}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OnContentPresenter" Storyboard.TargetProperty="Foreground">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchContentForegroundDisabled}" />+ </ObjectAnimationUsingKeyFrames>+ <ColorAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">+ <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchStrokeOffDisabled}" />+ </ColorAnimationUsingKeyFrames>+ <ColorAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">+ <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchFillOffDisabled}" />+ </ColorAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Fill">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchFillOnDisabled}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Stroke">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchStrokeOnDisabled}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Fill">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOffDisabled}" />+ </ObjectAnimationUsingKeyFrames>+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Background">+ <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleSwitchKnobFillOnDisabled}" />+ </ObjectAnimationUsingKeyFrames>+ <ColorAnimationUsingKeyFrames Storyboard.TargetName="SwitchAreaGrid" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">+ <LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{ThemeResource ToggleSwitchContainerBackgroundDisabled}" />+ </ColorAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOn"+ Storyboard.TargetProperty="Width">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlNormalAnimationDuration}"+ Value="12" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOn"+ Storyboard.TargetProperty="Height">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlNormalAnimationDuration}"+ Value="12" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOff"+ Storyboard.TargetProperty="Width">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlNormalAnimationDuration}"+ Value="12" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames+ EnableDependentAnimation="True"+ Storyboard.TargetName="SwitchKnobOff"+ Storyboard.TargetProperty="Height">+ <SplineDoubleKeyFrame+ KeySpline="{StaticResource ControlFastOutSlowInKeySpline}"+ KeyTime="{StaticResource ControlNormalAnimationDuration}"+ Value="12" />+ </DoubleAnimationUsingKeyFrames>+ </Storyboard>+ </VisualState>++ </VisualStateGroup>+ <VisualStateGroup x:Name="ToggleStates">++ <VisualStateGroup.Transitions>+ <VisualTransition+ x:Name="DraggingToOnTransition"+ GeneratedDuration="0"+ From="Dragging"+ To="On">++ <Storyboard>+ <RepositionThemeAnimation FromHorizontalOffset="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.KnobCurrentToOnOffset}" TargetName="SwitchKnob" />+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="1" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="1" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />+ </DoubleAnimationUsingKeyFrames>+ </Storyboard>+ </VisualTransition>+ <VisualTransition+ x:Name="OnToDraggingTransition"+ GeneratedDuration="0"+ From="On"+ To="Dragging">+ <Storyboard>+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="0" Value="1" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="0" Value="1" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="0" Value="0" />+ </DoubleAnimationUsingKeyFrames>+ </Storyboard>+ </VisualTransition>+ <VisualTransition+ x:Name="DraggingToOffTransition"+ GeneratedDuration="0"+ From="Dragging"+ To="Off">++ <Storyboard>+ <RepositionThemeAnimation FromHorizontalOffset="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.KnobCurrentToOffOffset}" TargetName="SwitchKnob" />+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="1" />+ </DoubleAnimationUsingKeyFrames>+ </Storyboard>+ </VisualTransition>+ <VisualTransition+ x:Name="OnToOffTransition"+ GeneratedDuration="0"+ From="On"+ To="Off">++ <Storyboard>+ <RepositionThemeAnimation FromHorizontalOffset="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.KnobOnToOffOffset}" TargetName="SwitchKnob" />+ </Storyboard>+ </VisualTransition>+ <VisualTransition+ x:Name="OffToOnTransition"+ GeneratedDuration="0"+ From="Off"+ To="On">++ <Storyboard>+ <RepositionThemeAnimation FromHorizontalOffset="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.KnobOffToOnOffset}" TargetName="SwitchKnob" />+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="1" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="1" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />+ </DoubleAnimationUsingKeyFrames>+ </Storyboard>+ </VisualTransition>+ </VisualStateGroup.Transitions>+ <VisualState x:Name="Dragging" />+ <VisualState x:Name="Off" />+ <VisualState x:Name="On">+ <Storyboard>+ <DoubleAnimation+ Storyboard.TargetName="KnobTranslateTransform"+ Storyboard.TargetProperty="X"+ To="20"+ Duration="0" />+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="1" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOn" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="1" />+ </DoubleAnimationUsingKeyFrames>+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobOff" Storyboard.TargetProperty="Opacity">+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />+ </DoubleAnimationUsingKeyFrames>+ </Storyboard>+ </VisualState>++ </VisualStateGroup>+ <VisualStateGroup x:Name="ContentStates">+ <VisualState x:Name="OffContent">++ <Storyboard>+ <DoubleAnimation+ Storyboard.TargetName="OffContentPresenter"+ Storyboard.TargetProperty="Opacity"+ To="1"+ Duration="0" />+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OffContentPresenter" Storyboard.TargetProperty="IsHitTestVisible">+ <DiscreteObjectKeyFrame KeyTime="0">+ <DiscreteObjectKeyFrame.Value>+ <x:Boolean>True</x:Boolean>+ </DiscreteObjectKeyFrame.Value>+ </DiscreteObjectKeyFrame>+ </ObjectAnimationUsingKeyFrames>+ </Storyboard>+ </VisualState>+ <VisualState x:Name="OnContent">++ <Storyboard>+ <DoubleAnimation+ Storyboard.TargetName="OnContentPresenter"+ Storyboard.TargetProperty="Opacity"+ To="1"+ Duration="0" />+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OnContentPresenter" Storyboard.TargetProperty="IsHitTestVisible">+ <DiscreteObjectKeyFrame KeyTime="0">+ <DiscreteObjectKeyFrame.Value>+ <x:Boolean>True</x:Boolean>+ </DiscreteObjectKeyFrame.Value>+ </DiscreteObjectKeyFrame>+ </ObjectAnimationUsingKeyFrames>+ </Storyboard>+ </VisualState>++ </VisualStateGroup>++ </VisualStateManager.VisualStateGroups>+ </Grid>++ </ControlTemplate>+ </Setter.Value>+ </Setter>+ </Style></ResourceDictionary>diff --git a/src/dev/impl/DevTools.Common/Themes/Generic.xaml b/src/dev/impl/DevTools.Common/Themes/Generic.xamlindex 7767bfc8c..33dc40dc4 100644--- a/src/dev/impl/DevTools.Common/Themes/Generic.xaml+++ b/src/dev/impl/DevTools.Common/Themes/Generic.xaml@@ -9,4 +9,8 @@<Setter Property="Width" Value="16"/><Setter Property="Fill" Value="{ThemeResource ApplicationForegroundThemeBrush}"/></Style>++ <Style TargetType="FontIcon">+ <Setter Property="FontFamily" Value="{StaticResource FluentSystemIcons}"/>+ </Style></ResourceDictionary>diff --git a/src/dev/impl/DevTools.Common/UI/Controls/ExpandableSettingControl.xaml b/src/dev/impl/DevTools.Common/UI/Controls/ExpandableSettingControl.xamlnew file mode 100644index 000000000..6c2cabb51--- /dev/null+++ b/src/dev/impl/DevTools.Common/UI/Controls/ExpandableSettingControl.xaml@@ -0,0 +1,64 @@+<UserControl+ x:Class="DevTools.Common.UI.Controls.ExpandableSettingControl"+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"+ xmlns:local="using:DevTools.Common.UI.Controls"+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"+ xmlns:muxc="using:Microsoft.UI.Xaml.Controls"+ xmlns:converters="using:DevTools.Common.UI.Converters"+ mc:Ignorable="d"+ HorizontalAlignment="Stretch"+ d:DesignHeight="300"+ d:DesignWidth="400">+ <UserControl.Resources>+ <converters:NullToBooleanConverter x:Key="NullToTrueConverter"/>+ <converters:NullToBooleanConverter x:Key="NullToFalseConverter" IsInverted="True"/>++ <Style x:Key="GridSettingBlockStyle" TargetType="Grid">+ <Setter Property="Background" Value="{ThemeResource ExpanderHeaderBackground}" />+ <Setter Property="BorderBrush" Value="{ThemeResource ExpanderHeaderBorderBrush}" />+ <Setter Property="BorderThickness" Value="{ThemeResource ExpanderHeaderBorderThickness}" />+ <Setter Property="HorizontalAlignment" Value="Stretch" />+ <Setter Property="MinHeight" Value="{StaticResource ExpanderMinHeight}" />+ <Setter Property="Padding" Value="{StaticResource ExpanderContentPadding}" />+ <Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />+ </Style>+ </UserControl.Resources>++ <Grid>++ <!-- Use an Expander control if there is content to expand. -->+ <Grid x:Name="ExpanderGrid" x:Load="{x:Bind ExpandableContent, Mode=OneWay, Converter={StaticResource NullToFalseConverter}}">+ <muxc:Expander+ HorizontalAlignment="Stretch"+ HorizontalContentAlignment="Stretch">+ <muxc:Expander.Header>+ <local:ExpandableSettingHeaderControl+ Title="{x:Bind Title, Mode=OneWay}"+ Margin="0,16"+ Description="{x:Bind Description, Mode=OneWay}"+ Icon="{x:Bind Icon, Mode=OneWay}"+ SettingActionableElement="{x:Bind SettingActionableElement, Mode=OneWay}" />+ </muxc:Expander.Header>++ <ContentPresenter+ HorizontalAlignment="Stretch"+ Margin="24,0,0,0"+ Content="{x:Bind ExpandableContent, Mode=OneWay}" />+ </muxc:Expander>+ </Grid>++ <!-- Fake an expander control if there's no expandable content. -->+ <Grid+ x:Name="NonExpanderGrid"+ x:Load="{x:Bind ExpandableContent, Mode=OneWay, Converter={StaticResource NullToTrueConverter}}"+ Style="{StaticResource GridSettingBlockStyle}">+ <local:ExpandableSettingHeaderControl+ Title="{x:Bind Title, Mode=OneWay}"+ Description="{x:Bind Description, Mode=OneWay}"+ Icon="{x:Bind Icon, Mode=OneWay}"+ SettingActionableElement="{x:Bind SettingActionableElement, Mode=OneWay}" />+ </Grid>+ </Grid>+</UserControl>diff --git a/src/dev/impl/DevTools.Common/UI/Controls/ExpandableSettingControl.xaml.cs b/src/dev/impl/DevTools.Common/UI/Controls/ExpandableSettingControl.xaml.csnew file mode 100644index 000000000..2670291b0--- /dev/null+++ b/src/dev/impl/DevTools.Common/UI/Controls/ExpandableSettingControl.xaml.cs@@ -0,0 +1,71 @@+#nullable enable++using Windows.UI.Xaml;+using Windows.UI.Xaml.Controls;+using Windows.UI.Xaml.Markup;++namespace DevTools.Common.UI.Controls+{+ [ContentProperty(Name = nameof(SettingActionableElement))]+ public sealed partial class ExpandableSettingControl : UserControl+ {+ public FrameworkElement? SettingActionableElement { get; set; }++ public static readonly DependencyProperty TitleProperty+ = DependencyProperty.Register(+ nameof(Title),+ typeof(string),+ typeof(ExpandableSettingControl),+ new PropertyMetadata(string.Empty));++ public string Title+ {+ get => (string)GetValue(TitleProperty);+ set => SetValue(TitleProperty, value);+ }++ public static readonly DependencyProperty DescriptionProperty+ = DependencyProperty.Register(+ nameof(Description),+ typeof(string),+ typeof(ExpandableSettingControl),+ new PropertyMetadata(string.Empty));++ public string Description+ {+ get => (string)GetValue(DescriptionProperty);+ set => SetValue(DescriptionProperty, value);+ }++ public static readonly DependencyProperty IconProperty+ = DependencyProperty.Register(+ nameof(Icon),+ typeof(IconElement),+ typeof(ExpandableSettingControl),+ new PropertyMetadata(null));++ public IconElement Icon+ {+ get => (IconElement)GetValue(IconProperty);+ set => SetValue(IconProperty, value);+ }++ public static readonly DependencyProperty ExpandableContentProperty+ = DependencyProperty.Register(+ nameof(ExpandableContent),+ typeof(FrameworkElement),+ typeof(ExpandableSettingControl),+ new PropertyMetadata(null));++ public FrameworkElement ExpandableContent+ {+ get => (FrameworkElement)GetValue(ExpandableContentProperty);+ set => SetValue(ExpandableContentProperty, value);+ }++ public ExpandableSettingControl()+ {+ InitializeComponent();+ }+ }+}diff --git a/src/dev/impl/DevTools.Common/UI/Controls/ExpandableSettingHeaderControl.xaml b/src/dev/impl/DevTools.Common/UI/Controls/ExpandableSettingHeaderControl.xamlnew file mode 100644index 000000000..e91f7515e--- /dev/null+++ b/src/dev/impl/DevTools.Common/UI/Controls/ExpandableSettingHeaderControl.xaml@@ -0,0 +1,96 @@+<UserControl+ x:Class="DevTools.Common.UI.Controls.ExpandableSettingHeaderControl"+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"+ xmlns:local="using:DevTools.Common.UI.Controls"+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"+ xmlns:converters="using:DevTools.Common.UI.Converters"+ mc:Ignorable="d"+ d:DesignHeight="300"+ d:DesignWidth="400">+ <UserControl.Resources>+ <converters:NullToBooleanConverter x:Key="NullToTrueConverter"/>+ <converters:NullToBooleanConverter x:Key="NullToFalseConverter" IsInverted="True"/>+ <converters:NullToBooleanConverter x:Key="StringNullOrWhiteSpaceToFalseConverter" IsInverted="True" EnforceNonWhiteSpaceString="True"/>++ <Style x:Key="TextBlockSettingDescriptionStyle" TargetType="TextBlock">+ <Setter Property="TextWrapping" Value="Wrap" />+ <Setter Property="FontSize" Value="12" />+ <Setter Property="Opacity" Value="0.75" />+ </Style>+ </UserControl.Resources>++ <Grid+ x:Name="MainPanel"+ HorizontalAlignment="Stretch"+ VerticalAlignment="Center">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ <ColumnDefinition Width="Auto" />+ </Grid.ColumnDefinitions>++ <Grid.RowDefinitions>+ <RowDefinition Height="*" />+ <RowDefinition Height="Auto" />+ </Grid.RowDefinitions>++ <ContentPresenter+ x:Name="SettingIconElement"+ Margin="2,0,20,0"+ x:Load="{x:Bind Icon, Mode=OneWay, Converter={StaticResource NullToFalseConverter}}"+ Content="{x:Bind Icon, Mode=OneWay}" />++ <Grid+ x:Name="DescriptionPanel"+ Grid.Column="1"+ HorizontalAlignment="Left"+ VerticalAlignment="Center">+ <Grid.RowDefinitions>+ <RowDefinition Height="Auto" />+ <RowDefinition Height="Auto" />+ </Grid.RowDefinitions>++ <TextBlock+ x:Name="TitleBlock"+ x:Load="{x:Bind Title, Mode=OneWay, Converter={StaticResource StringNullOrWhiteSpaceToFalseConverter}}"+ Text="{x:Bind Title, Mode=OneWay}"+ TextWrapping="Wrap" />++ <TextBlock+ x:Name="DescriptionBlock"+ Grid.Row="1"+ x:Load="{x:Bind Description, Mode=OneWay, Converter={StaticResource StringNullOrWhiteSpaceToFalseConverter}}"+ Style="{StaticResource TextBlockSettingDescriptionStyle}"+ Text="{x:Bind Description, Mode=OneWay}" />+ </Grid>++ <ContentPresenter+ x:Name="ActionableElement"+ Grid.Column="2"+ Margin="24,0,0,0"+ HorizontalAlignment="Right"+ VerticalAlignment="Center"+ x:Load="{x:Bind SettingActionableElement, Mode=OneWay, Converter={StaticResource NullToFalseConverter}}"+ Content="{x:Bind SettingActionableElement, Mode=OneWay}" />+ <VisualStateManager.VisualStateGroups>+ <VisualStateGroup>+ <VisualState x:Name="NormalState">+ <VisualState.Setters>+ <Setter Target="ActionableElement.(Grid.Row)" Value="0" />+ <Setter Target="ActionableElement.(Grid.Column)" Value="2" />+ <Setter Target="ActionableElement.Margin" Value="24,0,0,0" />+ </VisualState.Setters>+ </VisualState>+ <VisualState x:Name="CompactState">+ <VisualState.Setters>+ <Setter Target="ActionableElement.(Grid.Row)" Value="1" />+ <Setter Target="ActionableElement.(Grid.Column)" Value="1" />+ <Setter Target="ActionableElement.Margin" Value="0,4,0,0" />+ </VisualState.Setters>+ </VisualState>+ </VisualStateGroup>+ </VisualStateManager.VisualStateGroups>+ </Grid>+</UserControl>diff --git a/src/dev/impl/DevTools.Common/UI/Controls/ExpandableSettingHeaderControl.xaml.cs b/src/dev/impl/DevTools.Common/UI/Controls/ExpandableSettingHeaderControl.xaml.csnew file mode 100644index 000000000..f10d53f34--- /dev/null+++ b/src/dev/impl/DevTools.Common/UI/Controls/ExpandableSettingHeaderControl.xaml.cs@@ -0,0 +1,74 @@+#nullable enable++using Windows.UI.Xaml;+using Windows.UI.Xaml.Controls;+using Windows.UI.Xaml.Markup;++namespace DevTools.Common.UI.Controls+{+ [ContentProperty(Name = nameof(SettingActionableElement))]+ public sealed partial class ExpandableSettingHeaderControl : UserControl+ {+ public FrameworkElement? SettingActionableElement { get; set; }++ public static readonly DependencyProperty TitleProperty+ = DependencyProperty.Register(+ nameof(Title),+ typeof(string),+ typeof(ExpandableSettingHeaderControl),+ new PropertyMetadata(string.Empty));++ public string Title+ {+ get => (string)GetValue(TitleProperty);+ set => SetValue(TitleProperty, value);+ }++ public static readonly DependencyProperty DescriptionProperty+ = DependencyProperty.Register(+ nameof(Description),+ typeof(string),+ typeof(ExpandableSettingHeaderControl),+ new PropertyMetadata(string.Empty));++ public string Description+ {+ get => (string)GetValue(DescriptionProperty);+ set => SetValue(DescriptionProperty, value);+ }++ public static readonly DependencyProperty IconProperty+ = DependencyProperty.Register(+ nameof(Icon),+ typeof(IconElement),+ typeof(ExpandableSettingHeaderControl),+ new PropertyMetadata(null));++ public IconElement Icon+ {+ get => (IconElement)GetValue(IconProperty);+ set => SetValue(IconProperty, value);+ }++ public ExpandableSettingHeaderControl()+ {+ InitializeComponent();+ VisualStateManager.GoToState(this, "NormalState", false);+ }++ private void MainPanel_SizeChanged(object sender, SizeChangedEventArgs e)+ {+ if (e.NewSize.Width == e.PreviousSize.Width || ActionableElement == null)+ return;++ if (ActionableElement.ActualWidth > e.NewSize.Width / 3)+ {+ VisualStateManager.GoToState(this, "CompactState", false);+ }+ else+ {+ VisualStateManager.GoToState(this, "NormalState", false);+ }+ }+ }+}diff --git a/src/dev/impl/DevTools.Common/UI/Converters/NullToBooleanConverter.cs b/src/dev/impl/DevTools.Common/UI/Converters/NullToBooleanConverter.csnew file mode 100644index 000000000..040ba5ea6--- /dev/null+++ b/src/dev/impl/DevTools.Common/UI/Converters/NullToBooleanConverter.cs@@ -0,0 +1,49 @@+#nullable enable++using System;+using Windows.UI.Xaml.Data;++namespace DevTools.Common.UI.Converters+{+ /// <summary>+ /// Converts a null value to a <see cref="bool"/> value.+ /// </summary>+ public sealed class NullToBooleanConverter : IValueConverter+ {+ public bool IsInverted { get; set; }++ public bool EnforceNonWhiteSpaceString { get; set; }++ public object Convert(object value, Type targetType, object parameter, string language)+ {+ if (value?.GetType() == typeof(string))+ {+ if (IsInverted)+ {+ if (EnforceNonWhiteSpaceString)+ {+ return !string.IsNullOrWhiteSpace((string)value);+ }+ return !string.IsNullOrEmpty((string)value);+ }++ if (EnforceNonWhiteSpaceString)+ {+ return !string.IsNullOrWhiteSpace((string)value);+ }+ return string.IsNullOrEmpty((string)value);+ }++ if (IsInverted)+ {+ return value != null;+ }+ return value == null;+ }++ public object ConvertBack(object value, Type targetType, object parameter, string language)+ {+ throw new NotImplementedException();+ }+ }+}diff --git a/src/dev/impl/DevTools.Impl/Views/MainPage.xaml b/src/dev/impl/DevTools.Impl/Views/MainPage.xamlindex 71419e5a7..b43608938 100644--- a/src/dev/impl/DevTools.Impl/Views/MainPage.xaml+++ b/src/dev/impl/DevTools.Impl/Views/MainPage.xaml@@ -160,7 +160,7 @@Command="{Binding OpenToolInNewWindowCommand}"CommandParameter="{x:Bind Metadata}"><MenuFlyoutItem.Icon>- <FontIcon FontFamily="{StaticResource FluentSystemIcons}" Glyph="ø" />+ <FontIcon Glyph="ø" /></MenuFlyoutItem.Icon></MenuFlyoutItem></MenuFlyout>@@ -212,7 +212,7 @@<ScrollViewerMargin="12,0,0,0"- Padding="4,12,8,0"+ Padding="4,12,16,0"HorizontalScrollMode="Disabled"VerticalScrollBarVisibility="Auto"VerticalScrollMode="Enabled">diff --git a/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolPage.xaml b/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolPage.xamlindex 3b194f75d..1684ecd9e 100644--- a/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolPage.xaml+++ b/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolPage.xaml@@ -4,11 +4,105 @@xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:local="using:DevTools.Impl.Views.Settings"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="using:DevTools.Common.UI.Controls" xmlns:muxc="using:Microsoft.UI.Xaml.Controls"mc:Ignorable="d"NavigationCacheMode="Required">+ <Page.Resources>+ <Style x:Key="SubTitleTextBlock" TargetType="TextBlock">+ <Setter Property="FontSize" Value="14" />+ <Setter Property="FontWeight" Value="Medium" />+ <Setter Property="Margin" Value="0,12,0,0" />+ </Style>+ </Page.Resources>- <Grid>- <TextBlock Text="Settings"/>- </Grid>+ <StackPanel Spacing="4">+ <StackPanel.ChildrenTransitions>+ <TransitionCollection>+ <EntranceThemeTransition IsStaggeringEnabled="True" FromVerticalOffset="50"/>+ </TransitionCollection>+ </StackPanel.ChildrenTransitions>++ <controls:ExpandableSettingControl+ Title="App Theme"+ Description="Select which app theme to display">+ <controls:ExpandableSettingControl.Icon>+ <FontIcon Glyph="" />+ </controls:ExpandableSettingControl.Icon>+ <controls:ExpandableSettingControl.ExpandableContent>+ <StackPanel Spacing="4">+ <RadioButton+ Content="Light"/>+ <RadioButton+ Content="Dark"/>+ <RadioButton+ Content="Use system settings"+ IsChecked="True"/>+ </StackPanel>+ </controls:ExpandableSettingControl.ExpandableContent>+ </controls:ExpandableSettingControl>++ <TextBlock Style="{StaticResource SubTitleTextBlock}" Text="Behaviors" />++ <controls:ExpandableSettingControl+ Title="Smart detection"+ Description="Automatically detect the best tool based on the clipboard content">+ <controls:ExpandableSettingControl.Icon>+ <FontIcon Glyph="" />+ </controls:ExpandableSettingControl.Icon>+ <ToggleSwitch Style="{StaticResource RightAlignedToggleSwitchStyle}" IsOn="True"/>+ <!-- TODO: Put a demo/tutorial in ExpandableContent property -->+ </controls:ExpandableSettingControl>++ <TextBlock Style="{StaticResource SubTitleTextBlock}" Text="Text editor" />++ <controls:ExpandableSettingControl+ Title="Font">+ <controls:ExpandableSettingControl.Icon>+ <FontIcon Glyph="" />+ </controls:ExpandableSettingControl.Icon>+ <ComboBox>+ <ComboBoxItem Content="Cascadia Code"/>+ <ComboBoxItem Content="Cascadia Mono" IsSelected="True"/>+ <ComboBoxItem Content="Consolas"/>+ <ComboBoxItem Content="Segoe UI"/>+ </ComboBox>+ </controls:ExpandableSettingControl>++ <TextBlock Style="{StaticResource SubTitleTextBlock}" Text="About" />++ <controls:ExpandableSettingControl+ Title="DevTools"+ Description="Version 1.0.0.0">+ <controls:ExpandableSettingControl.Icon>+ <muxc:ImageIcon Source="/DevTools.Impl/Assets/Logo/Square44x44Logo.scale-200.png" Height="16" />+ </controls:ExpandableSettingControl.Icon>+ </controls:ExpandableSettingControl>++ <controls:ExpandableSettingControl+ Title="Useful links">+ <controls:ExpandableSettingControl.Icon>+ <FontIcon Glyph="" />+ </controls:ExpandableSettingControl.Icon>+ <controls:ExpandableSettingControl.ExpandableContent>+ <!-- TODO -->+ <Grid>+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="*"/>+ <ColumnDefinition Width="*"/>+ </Grid.ColumnDefinitions>+ <StackPanel Grid.Column="0">+ <HyperlinkButton Content="App website" NavigateUri="http://www.microsoft.com" />+ <HyperlinkButton Content="Privacy policy" NavigateUri="http://www.microsoft.com" />+ <HyperlinkButton Content="Rate and review on Microsoft Store" NavigateUri="http://www.microsoft.com" />+ <HyperlinkButton Content="Donate" NavigateUri="http://www.microsoft.com" />+ </StackPanel>+ <StackPanel Grid.Column="1">+ <HyperlinkButton Content="Source code" NavigateUri="http://www.microsoft.com" />+ <HyperlinkButton Content="License" NavigateUri="http://www.microsoft.com" />+ <HyperlinkButton Content="Report a problem" NavigateUri="http://www.microsoft.com" />+ </StackPanel>+ </Grid>+ </controls:ExpandableSettingControl.ExpandableContent>+ </controls:ExpandableSettingControl>+ </StackPanel></Page>diff --git a/src/tests/DevTools.Tests/UI/ConvertersTests.cs b/src/tests/DevTools.Tests/UI/ConvertersTests.csindex cd4246427..5bd18c2a2 100644--- a/src/tests/DevTools.Tests/UI/ConvertersTests.cs+++ b/src/tests/DevTools.Tests/UI/ConvertersTests.cs@@ -1,4 +1,6 @@-using DevTools.Common.UI.Converters;+#nullable disable++using DevTools.Common.UI.Converters;using Microsoft.VisualStudio.TestTools.UnitTesting;using Windows.UI.Xaml;@@ -21,5 +23,30 @@ namespace DevTools.Tests.UIAssert.AreEqual(Visibility.Collapsed, converter.Convert(true, typeof(Visibility), null, null));Assert.AreEqual(Visibility.Visible, converter.Convert(false, typeof(Visibility), null, null));}++ [TestMethod]+ public void NullToBooleanConverterTest()+ {+ var converter = new NullToBooleanConverter();+ converter.IsInverted = false;++ Assert.IsTrue((bool)converter.Convert(null, typeof(bool), null, null));+ Assert.IsFalse((bool)converter.Convert(1, typeof(bool), null, null));++ converter.IsInverted = true;++ Assert.IsFalse((bool)converter.Convert(null, typeof(bool), null, null));+ Assert.IsTrue((bool)converter.Convert(1, typeof(bool), null, null));++ converter.IsInverted = false;++ Assert.IsTrue((bool)converter.Convert(string.Empty, typeof(bool), null, null));+ Assert.IsFalse((bool)converter.Convert("foo", typeof(bool), null, null));++ converter.IsInverted = true;++ Assert.IsFalse((bool)converter.Convert(string.Empty, typeof(bool), null, null));+ Assert.IsTrue((bool)converter.Convert("foo", typeof(bool), null, null));+ }}}diff --git a/src/tests/DevTools.Tests/UnitTestApp.xaml.cs b/src/tests/DevTools.Tests/UnitTestApp.xaml.csindex 572e8d079..7f2a47f94 100644--- a/src/tests/DevTools.Tests/UnitTestApp.xaml.cs+++ b/src/tests/DevTools.Tests/UnitTestApp.xaml.cs@@ -1,18 +1,8 @@using System;-using System.Collections.Generic;-using System.IO;-using System.Linq;-using System.Runtime.InteropServices.WindowsRuntime;using Windows.ApplicationModel;using Windows.ApplicationModel.Activation;-using Windows.Foundation;-using Windows.Foundation.Collections;using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;-using Windows.UI.Xaml.Controls.Primitives;-using Windows.UI.Xaml.Data;-using Windows.UI.Xaml.Input;-using Windows.UI.Xaml.Media;using Windows.UI.Xaml.Navigation;namespace DevTools.Tests@@ -28,8 +18,8 @@ namespace DevTools.Tests/// </summary>public App(){- this.InitializeComponent();- this.Suspending += OnSuspending;+ InitializeComponent();+ Suspending += OnSuspending;}/// <summary>@@ -42,7 +32,7 @@ namespace DevTools.Tests#if DEBUGif (System.Diagnostics.Debugger.IsAttached){- this.DebugSettings.EnableFrameRateCounter = true;+ DebugSettings.EnableFrameRateCounter = true;}#endif