diff --git a/Settings.XamlStyler b/Settings.XamlStyler index 3d76cddc6..059bef472 100644 --- a/Settings.XamlStyler +++ b/Settings.XamlStyler @@ -3,7 +3,7 @@ "KeepFirstAttributeOnSameLine": true, "MaxAttributeCharactersPerLine": 0, "MaxAttributesPerLine": 1, - "NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter, StaticResource", + "NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter, StaticResource, SolidColorBrush", "SeparateByGroups": false, "AttributeIndentation": 0, "AttributeIndentationStyle": 0, diff --git a/Uno.Gallery/Uno.Gallery.Shared/Extensions/ResourceExtensions.cs b/Uno.Gallery/Uno.Gallery.Shared/Extensions/ResourceExtensions.cs new file mode 100644 index 000000000..3382307d6 --- /dev/null +++ b/Uno.Gallery/Uno.Gallery.Shared/Extensions/ResourceExtensions.cs @@ -0,0 +1,38 @@ +using Microsoft.UI.Xaml; +using System; + +namespace Uno.Gallery +{ + /// + /// Helper class for Resources Extensions. + /// + public static class ResourceExtensions + { + public static readonly DependencyProperty OverridePathProperty = + DependencyProperty.RegisterAttached( + "OverridePath", + typeof(string), + typeof(ResourceExtensions), + new PropertyMetadata(null, OnOverridePathChanged)); + + public static void SetOverridePath(FrameworkElement element, string value) + { + element.SetValue(OverridePathProperty, value); + } + + public static string GetOverridePath(FrameworkElement element) + { + return (string)element.GetValue(OverridePathProperty); + } + + private static void OnOverridePathChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + if (d is FrameworkElement fe) + { + fe.Resources = e.NewValue is string path + ? new ResourceDictionary() { Source = new Uri(path, UriKind.RelativeOrAbsolute) } + : default; + } + } + } +} diff --git a/Uno.Gallery/Uno.Gallery.Shared/Uno.Gallery.Shared.projitems b/Uno.Gallery/Uno.Gallery.Shared/Uno.Gallery.Shared.projitems index 71a767a8a..3f08f630c 100644 --- a/Uno.Gallery/Uno.Gallery.Shared/Uno.Gallery.Shared.projitems +++ b/Uno.Gallery/Uno.Gallery.Shared/Uno.Gallery.Shared.projitems @@ -173,6 +173,7 @@ + @@ -186,6 +187,38 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + <_Globbled_Page Include="$(MSBuildThisFileDirectory)**/*.xaml" Exclude="@(Page);@(ApplicationDefinition)"> Designer MSBuild:Compile diff --git a/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Fluent/Button.xaml b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Fluent/Button.xaml new file mode 100644 index 000000000..f897eaba6 --- /dev/null +++ b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Fluent/Button.xaml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Fluent/CheckBox.xaml b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Fluent/CheckBox.xaml new file mode 100644 index 000000000..999548ea5 --- /dev/null +++ b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Fluent/CheckBox.xaml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Fluent/RadioButton.xaml b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Fluent/RadioButton.xaml new file mode 100644 index 000000000..db7f43f0d --- /dev/null +++ b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Fluent/RadioButton.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Fluent/TextBox.xaml b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Fluent/TextBox.xaml new file mode 100644 index 000000000..f68d33743 --- /dev/null +++ b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Fluent/TextBox.xaml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Material/Button.xaml b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Material/Button.xaml new file mode 100644 index 000000000..71a8b0441 --- /dev/null +++ b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Material/Button.xaml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Material/CheckBox.xaml b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Material/CheckBox.xaml new file mode 100644 index 000000000..bfe92fa25 --- /dev/null +++ b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Material/CheckBox.xaml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Material/RadioButton.xaml b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Material/RadioButton.xaml new file mode 100644 index 000000000..db7f43f0d --- /dev/null +++ b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Material/RadioButton.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Material/TextBox.xaml b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Material/TextBox.xaml new file mode 100644 index 000000000..17d7e257d --- /dev/null +++ b/Uno.Gallery/Uno.Gallery.Shared/Views/ControlResourcesOverride/Material/TextBox.xaml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + diff --git a/Uno.Gallery/Uno.Gallery.Shared/Views/SamplePages/LightWeightExtensionSamplePage.xaml b/Uno.Gallery/Uno.Gallery.Shared/Views/SamplePages/LightWeightExtensionSamplePage.xaml new file mode 100644 index 000000000..496d418e8 --- /dev/null +++ b/Uno.Gallery/Uno.Gallery.Shared/Views/SamplePages/LightWeightExtensionSamplePage.xaml @@ -0,0 +1,400 @@ + + + + + + + + + + + +