Skip to content

A Swiss Army knife for developers.

Added some resources

Etienne Baudoux5e6b91588e35
diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props
index da3d4e19b..7b678493d 100644
--- a/src/Directory.Packages.props
+++ b/src/Directory.Packages.props
@@ -9,6 +9,7 @@
<MicrosoftNETCoreUniversalWindowsPlatformVersion>6.2.14</MicrosoftNETCoreUniversalWindowsPlatformVersion>
<MicrosoftWindowsSDKBuildToolsVersion>10.0.22621.1</MicrosoftWindowsSDKBuildToolsVersion>
<PolySharpVersion>1.8.1</PolySharpVersion>
+ <ThisAssemblyVersion>1.1.1</ThisAssemblyVersion>
<UnoVersion>4.6.39</UnoVersion>
<UnoWasmBootstrapVersion>8.0.0-dev.65</UnoWasmBootstrapVersion>
<WebView2Version>1.0.1462.37</WebView2Version>
@@ -38,6 +39,7 @@
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageVersion Include="System.ComponentModel.Composition" Version="$(DotNetVersion)" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
+ <PackageVersion Include="ThisAssembly" Version="$(ThisAssemblyVersion)"/>
<PackageVersion Include="Uno.Core.Extensions.Logging" Version="4.0.1" />
<PackageVersion Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.1" />
<PackageVersion Include="Uno.Extensions.Logging.WebAssembly.Console" Version="1.4.0" />
diff --git a/src/app/dev/DevToys.Api/DevToys.Api.csproj b/src/app/dev/DevToys.Api/DevToys.Api.csproj
index 8449456df..f35132d63 100644
--- a/src/app/dev/DevToys.Api/DevToys.Api.csproj
+++ b/src/app/dev/DevToys.Api/DevToys.Api.csproj
@@ -9,5 +9,6 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="System.ComponentModel.Composition" />
<PackageReference Include="System.Threading.Tasks.Extensions" />
+ <PackageReference Include="ThisAssembly" />
</ItemGroup>
</Project>
\ No newline at end of file
diff --git a/src/app/dev/DevToys.Core/DevToys.Core.csproj b/src/app/dev/DevToys.Core/DevToys.Core.csproj
index 510c71463..057e68b44 100644
--- a/src/app/dev/DevToys.Core/DevToys.Core.csproj
+++ b/src/app/dev/DevToys.Core/DevToys.Core.csproj
@@ -10,5 +10,6 @@
<PackageReference Include="CommunityToolkit.Diagnostics" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="System.ComponentModel.Composition" />
+ <PackageReference Include="ThisAssembly" />
</ItemGroup>
</Project>
\ No newline at end of file
diff --git a/src/app/dev/DevToys.MonacoEditor/CodeEditor/CodeEditor.cs b/src/app/dev/DevToys.MonacoEditor/CodeEditor/CodeEditor.cs
index 74e3ffc79..4b0efbf9d 100644
--- a/src/app/dev/DevToys.MonacoEditor/CodeEditor/CodeEditor.cs
+++ b/src/app/dev/DevToys.MonacoEditor/CodeEditor/CodeEditor.cs
@@ -696,6 +696,8 @@ public sealed partial class CodeEditor : Control, IParentAccessorAcceptor, IDisp
.Forget();
// Update options.
+ Options.SmoothScrolling = true;
+ Options.Minimap = new EditorMinimapOptions() { Enabled = false };
Options.ReadOnly = ReadOnly;
Options.Language = CodeLanguage;
DiffOptions.OriginalEditable = !ReadOnly;
diff --git a/src/app/dev/DevToys.MonacoEditor/CodeEditor/CodeEditorPresenter.Wasm.cs b/src/app/dev/DevToys.MonacoEditor/CodeEditor/CodeEditorPresenter.Wasm.cs
index 1cefe5d0a..db29b219e 100644
--- a/src/app/dev/DevToys.MonacoEditor/CodeEditor/CodeEditorPresenter.Wasm.cs
+++ b/src/app/dev/DevToys.MonacoEditor/CodeEditor/CodeEditorPresenter.Wasm.cs
@@ -118,7 +118,7 @@ public sealed partial class CodeEditorPresenter : Control, ICodeEditorPresenter,
return Task.CompletedTask;
}
- string? native = method.Invoke(obj.Handle, new object[] { }) as string;
+ string? native = method.Invoke(obj.Handle, Array.Empty<object>()) as string;
_debugLogger?.Debug($"{nameof(InjectDotNetObjectToWebPageAsync)}: Native handle {native} - {name}");
string injectorScript
diff --git a/src/app/dev/DevToys.Tools/Sample/SampleToolFactory.cs b/src/app/dev/DevToys.Tools/Sample/SampleToolFactory.cs
index 74d9600f1..22b23e551 100644
--- a/src/app/dev/DevToys.Tools/Sample/SampleToolFactory.cs
+++ b/src/app/dev/DevToys.Tools/Sample/SampleToolFactory.cs
@@ -50,6 +50,7 @@ internal sealed class SampleCommandLineTool : ICommandLineTool
[TargetPlatform(Platform.Windows)] // Optional. Not putting any attribute means every platforms are supported.
[TargetPlatform(Platform.Linux)]
[TargetPlatform(Platform.MacOS)]
+[TargetPlatform(Platform.WASM)]
internal sealed class SampleGuiTool : IGuiTool
{
public UIElement View => throw new NotImplementedException();
diff --git a/src/app/dev/DevToys.UI.EntryPoint/App.xaml b/src/app/dev/DevToys.UI.EntryPoint/App.xaml
index d57bda003..be0e2e4c5 100644
--- a/src/app/dev/DevToys.UI.EntryPoint/App.xaml
+++ b/src/app/dev/DevToys.UI.EntryPoint/App.xaml
@@ -8,6 +8,7 @@
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
+ <ResourceDictionary Source="ms-appx:///DevToys.UI.Framework/Themes/Generic.xaml"/>
<!-- Add resource dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Add resources here -->
diff --git a/src/app/dev/DevToys.UI.EntryPoint/App.xaml.cs b/src/app/dev/DevToys.UI.EntryPoint/App.xaml.cs
index 3ffcf9025..7785bc964 100644
--- a/src/app/dev/DevToys.UI.EntryPoint/App.xaml.cs
+++ b/src/app/dev/DevToys.UI.EntryPoint/App.xaml.cs
@@ -4,6 +4,7 @@ using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
#if WINDOWS_UWP
+#nullable enable
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
diff --git a/src/app/dev/DevToys.UI.Framework/Assets/FluentSystemIcons-Regular.ttf b/src/app/dev/DevToys.UI.Framework/Assets/FluentSystemIcons-Regular.ttf
new file mode 100644
index 000000000..5a64afb3a
Binary files /dev/null and b/src/app/dev/DevToys.UI.Framework/Assets/FluentSystemIcons-Regular.ttf differ
diff --git a/src/app/dev/DevToys.UI.Framework/Converters/BooleanToVisibilityConverters.cs b/src/app/dev/DevToys.UI.Framework/Converters/BooleanToVisibilityConverters.cs
index ddb67ffac..f6cab72e3 100644
--- a/src/app/dev/DevToys.UI.Framework/Converters/BooleanToVisibilityConverters.cs
+++ b/src/app/dev/DevToys.UI.Framework/Converters/BooleanToVisibilityConverters.cs
@@ -1,4 +1,5 @@
#if WINDOWS_UWP
+#nullable enable
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
#else
diff --git a/src/app/dev/DevToys.UI.Framework/Converters/NegateBooleanConverter.cs b/src/app/dev/DevToys.UI.Framework/Converters/NegateBooleanConverter.cs
index 477a28813..dcda2bb78 100644
--- a/src/app/dev/DevToys.UI.Framework/Converters/NegateBooleanConverter.cs
+++ b/src/app/dev/DevToys.UI.Framework/Converters/NegateBooleanConverter.cs
@@ -1,8 +1,7 @@
#if WINDOWS_UWP
-using Windows.UI.Xaml;
+#nullable enable
using Windows.UI.Xaml.Data;
#else
-using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Data;
#endif
diff --git a/src/app/dev/DevToys.UI.Framework/DevToys.UI.Framework.csproj b/src/app/dev/DevToys.UI.Framework/DevToys.UI.Framework.csproj
index 99d2a0633..5da4f1d10 100644
--- a/src/app/dev/DevToys.UI.Framework/DevToys.UI.Framework.csproj
+++ b/src/app/dev/DevToys.UI.Framework/DevToys.UI.Framework.csproj
@@ -68,6 +68,7 @@
<UpToDateCheckInput Include="**\*.xaml" />
<Page Include="**\*.xaml" />
<Content Include="Assets\**" />
+ <PRIResource Include="**\*.resw" />
<Compile Update="**\*.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon>
</Compile>
diff --git a/src/app/dev/DevToys.UI.Framework/MarkupExtensions/StringResourceExtension.cs b/src/app/dev/DevToys.UI.Framework/MarkupExtensions/StringResourceExtension.cs
new file mode 100644
index 000000000..539dc84b3
--- /dev/null
+++ b/src/app/dev/DevToys.UI.Framework/MarkupExtensions/StringResourceExtension.cs
@@ -0,0 +1,25 @@
+#if WINDOWS_UWP
+#nullable enable
+using Windows.UI.Xaml.Markup;
+#else
+using Microsoft.UI.Xaml.Markup;
+#endif
+
+using Windows.ApplicationModel.Resources;
+
+namespace DevToys.UI.Framework.MarkupExtensions;
+
+[MarkupExtensionReturnType(ReturnType = typeof(string))]
+public sealed class StringResource : MarkupExtension
+{
+ private static readonly ResourceLoader resourceLoader = new("DevToys.UI.Framework/Strings");
+
+ public StringResource() { }
+
+ public string Key { get; set; } = "";
+
+ protected override object ProvideValue()
+ {
+ return resourceLoader.GetString(Key);
+ }
+}
diff --git a/src/app/dev/DevToys.UI.Framework/Strings/en-US/Strings.resw b/src/app/dev/DevToys.UI.Framework/Strings/en-US/Strings.resw
new file mode 100644
index 000000000..fe2e9d9a0
--- /dev/null
+++ b/src/app/dev/DevToys.UI.Framework/Strings/en-US/Strings.resw
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="ToggleSwitchOff" xml:space="preserve">
+ <value>On</value>
+ </data>
+ <data name="ToggleSwitchOn" xml:space="preserve">
+ <value>Off</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/app/dev/DevToys.UI.Framework/Themes/Generic.xaml b/src/app/dev/DevToys.UI.Framework/Themes/Generic.xaml
index 8e69621a3..0c595d3a1 100644
--- a/src/app/dev/DevToys.UI.Framework/Themes/Generic.xaml
+++ b/src/app/dev/DevToys.UI.Framework/Themes/Generic.xaml
@@ -1,5 +1,668 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:ext="using:DevToys.UI.Framework.MarkupExtensions">
+ <ResourceDictionary.ThemeDictionaries>
+ <ResourceDictionary x:Key="Light">
+ <SolidColorBrush x:Key="TextEditorForeground" Color="Black"/>
+
+ <!-- REVIEW: If Navigation View Content Grid Border Brush has transparency, it makes WebView being unclickable (can't get focus),
+ which breaks Monaco Editor. The line below change the border brush to use a solid one (without transparency). -->
+ <StaticResource x:Key="NavigationViewContentGridBorderBrush" ResourceKey="CardStrokeColorDefaultSolidBrush" />
+ </ResourceDictionary>
+ <ResourceDictionary x:Key="Dark">
+ <SolidColorBrush x:Key="TextEditorForeground" Color="#F0F0F0"/>
+
+ <!-- REVIEW: If Navigation View Content Grid Border Brush has transparency, it makes WebView being unclickable (can't get focus),
+ which breaks Monaco Editor. The line below change the border brush to use a solid one (without transparency). -->
+ <StaticResource x:Key="NavigationViewContentGridBorderBrush" ResourceKey="CardStrokeColorDefaultSolidBrush" />
+ </ResourceDictionary>
+ <ResourceDictionary x:Key="HighContrast">
+ <SolidColorBrush x:Key="TextEditorForeground" Color="{ThemeResource TextControlForeground}"/>
+ </ResourceDictionary>
+ </ResourceDictionary.ThemeDictionaries>
+
+ <FontFamily x:Key="FluentSystemIcons">ms-appx:///Assets/FluentSystemIcons-Regular.ttf#FluentSystemIcons-Regular</FontFamily>
+
+ <!-- Icons. Most of them are from https://github.com/microsoft/fluentui-system-icons/blob/master/icons.md -->
+ <x:String x:Key="EnterCompactOverlayPathIconData">M41.6339 8.13376C42.122 7.64561 42.122 6.85415 41.6339 6.36599C41.1457 5.87784 40.3543 5.87784 39.8661 6.36599L29.5002 16.732V7.25C29.5002 6.55964 28.9405 6 28.2502 6C27.5598 6 27.0002 6.55964 27.0002 7.25V19.75C27.0002 20.4404 27.5598 21 28.2502 21H40.75C41.4404 21 42 20.4404 42 19.75C42 19.0596 41.4404 18.5 40.75 18.5H31.2676L41.6339 8.13376ZM8.5 12.25C8.5 10.1789 10.1789 8.5 12.25 8.5H20.1346C20.825 8.5 21.3846 7.94036 21.3846 7.25C21.3846 6.55964 20.825 6 20.1346 6H12.25C8.79822 6 6 8.79822 6 12.25V35.75C6 39.2018 8.79822 42 12.25 42H35.75C39.2018 42 42 39.2018 42 35.75V27.8654C42 27.175 41.4404 26.6154 40.75 26.6154C40.0596 26.6154 39.5 27.175 39.5 27.8654V35.75C39.5 37.8211 37.8211 39.5 35.75 39.5H24V29.2499C24 26.3504 21.6495 23.9999 18.75 23.9999H8.5V12.25ZM8.5 26.4999H18.75C20.2688 26.4999 21.5 27.7311 21.5 29.2499V39.5H12.25C10.1789 39.5 8.5 37.8211 8.5 35.75V26.4999Z</x:String>
+ <x:String x:Key="ExitCompactOverlayPathIconData">M39.5 12.25C39.5 10.1789 37.8211 8.5 35.75 8.5H27.8654C27.175 8.5 26.6154 7.94036 26.6154 7.25C26.6154 6.55964 27.175 6 27.8654 6H35.75C39.2018 6 42 8.79822 42 12.25V35.75C42 39.2018 39.2018 42 35.75 42H12.25C8.79822 42 6 39.2018 6 35.75V27.8654C6 27.175 6.55964 26.6154 7.25 26.6154C7.94036 26.6154 8.5 27.175 8.5 27.8654V35.75C8.5 37.8211 10.1789 39.5 12.25 39.5H24V29.25C24 26.3505 26.3505 24 29.25 24H39.5V12.25ZM39.5 26.5H29.25C27.7312 26.5 26.5 27.7312 26.5 29.25V39.5H35.75C37.8211 39.5 39.5 37.8211 39.5 35.75V26.5ZM21 7.25C21 6.55964 20.4404 6 19.75 6H7.25015C6.55979 6 6.00015 6.55964 6.00015 7.25V19.75C6.00015 20.4404 6.55979 21 7.25015 21C7.94051 21 8.50015 20.4404 8.50015 19.75V10.2679L18.8661 20.6339C19.3543 21.122 20.1457 21.122 20.6339 20.6339C21.122 20.1457 21.122 19.3543 20.6339 18.8661L10.2678 8.5H19.75C20.4404 8.5 21 7.94036 21 7.25Z</x:String>
+
+ <Style TargetType="ContentControl">
+ <Setter Property="HighContrastAdjustment" Value="None"/>
+ </Style>
+
+ <Style TargetType="ContentPresenter">
+ <Setter Property="HighContrastAdjustment" Value="None"/>
+ </Style>
+
+ <Style TargetType="FontIcon">
+ <Setter Property="FontFamily" Value="{StaticResource FluentSystemIcons}"/>
+ <Setter Property="HighContrastAdjustment" Value="None"/>
+ </Style>
+
+ <Style TargetType="TextBlock">
+ <Setter Property="HighContrastAdjustment" Value="None"/>
+ </Style>
+
+ <Style TargetType="ToggleSwitch">
+ <Setter Property="OnContent" Value="{ext:StringResource Key=ToggleSwitchOn}"/>
+ <Setter Property="OffContent" Value="{ext:StringResource Key=ToggleSwitchOff}"/>
+ </Style>
+
+ <!-- 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="OnContent" Value="{ext:StringResource Key=ToggleSwitchOn}"/>
+ <Setter Property="OffContent" Value="{ext:StringResource Key=ToggleSwitchOff}"/>
+ <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" />
+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SwitchKnobBounds" Storyboard.TargetProperty="Opacity">
+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="0" />
+ </DoubleAnimationUsingKeyFrames>
+ <DoubleAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="Opacity">
+ <LinearDoubleKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="1" />
+ </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="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>
+
+ <Style x:Key="SubTitleTextBlock" TargetType="TextBlock">
+ <Setter Property="Foreground" Value="{ThemeResource TextControlHeaderForeground}" />
+ <Setter Property="FontSize" Value="14" />
+ <Setter Property="FontWeight" Value="Normal" />
+ <Setter Property="Margin" Value="0,12,0,0" />
+ </Style>
</ResourceDictionary>
diff --git a/src/app/dev/DevToys.UI.Framework/Threading/DispatcherQueueExtensions.cs b/src/app/dev/DevToys.UI.Framework/Threading/DispatcherQueueExtensions.cs
index 316314c53..9115994af 100644
--- a/src/app/dev/DevToys.UI.Framework/Threading/DispatcherQueueExtensions.cs
+++ b/src/app/dev/DevToys.UI.Framework/Threading/DispatcherQueueExtensions.cs
@@ -1,4 +1,5 @@
#if WINDOWS_UWP
+#nullable enable
using Windows.ApplicationModel.Core;
using Windows.UI.Core;
using DispatcherQueue = Windows.UI.Core.CoreDispatcher;
diff --git a/src/app/dev/DevToys.UI/DevToys.UI.csproj b/src/app/dev/DevToys.UI/DevToys.UI.csproj
index 542372f70..7f6f4019d 100644
--- a/src/app/dev/DevToys.UI/DevToys.UI.csproj
+++ b/src/app/dev/DevToys.UI/DevToys.UI.csproj
@@ -70,6 +70,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <PRIResource Include="**\*.resw" />
<Content Include="Assets\**" />
<Compile Update="**\*.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon>
diff --git a/src/app/dev/DevToys.UI/Strings/en/Resources.resw b/src/app/dev/DevToys.UI/Strings/en-US/Resources.resw
similarity index 100%
rename from src/app/dev/DevToys.UI/Strings/en/Resources.resw
rename to src/app/dev/DevToys.UI/Strings/en-US/Resources.resw
diff --git a/src/app/dev/DevToys.UI/Views/MainPage.xaml b/src/app/dev/DevToys.UI/Views/MainPage.xaml
index 6ec101b60..d9a894799 100644
--- a/src/app/dev/DevToys.UI/Views/MainPage.xaml
+++ b/src/app/dev/DevToys.UI/Views/MainPage.xaml
@@ -29,5 +29,14 @@
Grid.Column="1"
ReadOnly="True"
IsDiffViewMode="True"/>
+ <ToggleSwitch
+ Grid.Row="1"
+ Grid.Column="0"
+ Header="Test"/>
+ <ToggleSwitch
+ Grid.Row="1"
+ Grid.Column="1"
+ Header="Test"
+ Style="{StaticResource RightAlignedToggleSwitchStyle}"/>
</Grid>
</Page>
diff --git a/src/app/dev/platforms/desktop/DevToys.CLI/DevToys.CLI.csproj b/src/app/dev/platforms/desktop/DevToys.CLI/DevToys.CLI.csproj
index 7db16bee1..df3bbe998 100644
--- a/src/app/dev/platforms/desktop/DevToys.CLI/DevToys.CLI.csproj
+++ b/src/app/dev/platforms/desktop/DevToys.CLI/DevToys.CLI.csproj
@@ -10,6 +10,7 @@
<PackageReference Include="CommunityToolkit.Diagnostics" />
<PackageReference Include="System.CommandLine" />
<PackageReference Include="System.ComponentModel.Composition" />
+ <PackageReference Include="ThisAssembly" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" />
</ItemGroup>
diff --git a/src/app/dev/platforms/desktop/windows/DevToys.Windows.Core/DevToys.Windows.Core.csproj b/src/app/dev/platforms/desktop/windows/DevToys.Windows.Core/DevToys.Windows.Core.csproj
index 5e5f6f17a..a3bb5e7d3 100644
--- a/src/app/dev/platforms/desktop/windows/DevToys.Windows.Core/DevToys.Windows.Core.csproj
+++ b/src/app/dev/platforms/desktop/windows/DevToys.Windows.Core/DevToys.Windows.Core.csproj
@@ -94,6 +94,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
+ <PackageReference Include="ThisAssembly" Version="$(ThisAssemblyVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\DevToys.Api\DevToys.Api.csproj">
diff --git a/src/app/dev/platforms/desktop/windows/DevToys.Windows.Core/Package.appxmanifest b/src/app/dev/platforms/desktop/windows/DevToys.Windows.Core/Package.appxmanifest
index c4c12fd40..6d4b12c62 100644
--- a/src/app/dev/platforms/desktop/windows/DevToys.Windows.Core/Package.appxmanifest
+++ b/src/app/dev/platforms/desktop/windows/DevToys.Windows.Core/Package.appxmanifest
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
diff --git a/src/app/dev/platforms/desktop/windows/DevToys.Windows/Package.appxmanifest b/src/app/dev/platforms/desktop/windows/DevToys.Windows/Package.appxmanifest
index d75bfa49a..ea8f6e8fa 100644
--- a/src/app/dev/platforms/desktop/windows/DevToys.Windows/Package.appxmanifest
+++ b/src/app/dev/platforms/desktop/windows/DevToys.Windows/Package.appxmanifest
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
diff --git a/src/app/dev/platforms/web/DevToys.Wasm/DevToys.Wasm.csproj b/src/app/dev/platforms/web/DevToys.Wasm/DevToys.Wasm.csproj
index 2aca52fe2..b0bd66255 100644
--- a/src/app/dev/platforms/web/DevToys.Wasm/DevToys.Wasm.csproj
+++ b/src/app/dev/platforms/web/DevToys.Wasm/DevToys.Wasm.csproj
@@ -46,6 +46,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Microsoft.Windows.Compatibility" />
+ <PackageReference Include="ThisAssembly" />
<PackageReference Include="Uno.Extensions.Logging.WebAssembly.Console" />
<PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" />
<PackageReference Include="Uno.Wasm.Bootstrap" />
diff --git a/src/app/dev/shared/SharedAssemblyVersion.cs b/src/app/dev/shared/SharedAssemblyVersion.cs
index ca6cc03bb..c42dc3f67 100644
--- a/src/app/dev/shared/SharedAssemblyVersion.cs
+++ b/src/app/dev/shared/SharedAssemblyVersion.cs
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//