generated from unoplatform/template
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
deb6534
commit a6d6000
Showing
15 changed files
with
942 additions
and
4 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
Uno.Gallery/Uno.Gallery.Shared/Extensions/ControlExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System; | ||
using Windows.UI.Xaml; | ||
|
||
namespace Uno.Gallery | ||
{ | ||
/// <summary> | ||
/// Helper class for Controls Extensions. | ||
/// </summary> | ||
public static class ControlExtensions | ||
{ | ||
public static readonly DependencyProperty ResourcePathProperty = | ||
DependencyProperty.RegisterAttached( | ||
"ResourcePath", | ||
typeof(string), | ||
typeof(ControlExtensions), | ||
new PropertyMetadata(null, OnResourcePathChanged)); | ||
|
||
public static void SetResourcePath(FrameworkElement element, string value) | ||
{ | ||
element.SetValue(ResourcePathProperty, value); | ||
} | ||
|
||
public static string GetResourcePath(FrameworkElement element) | ||
{ | ||
return (string)element.GetValue(ResourcePathProperty); | ||
} | ||
|
||
private static void OnResourcePathChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | ||
{ | ||
var control = d as FrameworkElement; | ||
if (control != null) | ||
{ | ||
var resourcePath = (string)e.NewValue; | ||
AddResourcesFromPath(control, resourcePath); | ||
} | ||
} | ||
|
||
private static void AddResourcesFromPath(FrameworkElement control, string resourcePath) | ||
{ | ||
// Load the resource dictionary | ||
var resources = new ResourceDictionary() | ||
{ | ||
Source = new Uri(resourcePath, UriKind.RelativeOrAbsolute) | ||
}; | ||
|
||
// Add or replace the resources in this control's resource dictionary | ||
foreach (var key in resources.Keys) | ||
{ | ||
if (control.Resources.ContainsKey(key)) | ||
control.Resources[key] = resources[key]; | ||
else | ||
control.Resources.Add(key, resources[key]); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
Uno.Gallery/Uno.Gallery.UWP/Views/ControlResourcesOverride/Fluent/Button.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
|
||
<SolidColorBrush x:Key="ButtonForeground" | ||
Color="DarkGreen" /> | ||
<SolidColorBrush x:Key="ButtonBackground" | ||
Color="LightGreen" /> | ||
<SolidColorBrush x:Key="ButtonBorderBrush" | ||
Color="DarkGreen" /> | ||
|
||
<SolidColorBrush x:Key="ButtonForegroundPointerOver" | ||
Color="DarkRed" /> | ||
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" | ||
Color="LightPink" /> | ||
<SolidColorBrush x:Key="ButtonBorderBrushPointerOver" | ||
Color="DarkRed" /> | ||
|
||
<SolidColorBrush x:Key="ButtonForegroundPressed" | ||
Color="DarkBlue" /> | ||
<SolidColorBrush x:Key="ButtonBackgroundPressed" | ||
Color="LightSteelBlue" /> | ||
<SolidColorBrush x:Key="ButtonBorderBrushPressed" | ||
Color="DarkBlue" /> | ||
|
||
<SolidColorBrush x:Key="ButtonForegroundDisabled" | ||
Color="LightSlateGray" /> | ||
<SolidColorBrush x:Key="ButtonBackgroundDisabled" | ||
Color="DarkGray" /> | ||
<SolidColorBrush x:Key="ButtonBorderBrushDisabled" | ||
Color="LightSlateGray" /> | ||
|
||
</ResourceDictionary> |
52 changes: 52 additions & 0 deletions
52
Uno.Gallery/Uno.Gallery.UWP/Views/ControlResourcesOverride/Fluent/CheckBox.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
|
||
<!-- Checked state --> | ||
<SolidColorBrush x:Key="CheckBoxCheckGlyphForegroundChecked" | ||
Color="Teal" /> | ||
<SolidColorBrush x:Key="CheckBoxBorderBrushChecked" | ||
Color="Navy" /> | ||
<SolidColorBrush x:Key="CheckBoxBackgroundChecked" | ||
Color="Maroon" /> | ||
|
||
<!-- Checked and pointer over state --> | ||
<SolidColorBrush x:Key="CheckBoxCheckGlyphForegroundCheckedPointerOver" | ||
Color="Lime" /> | ||
<SolidColorBrush x:Key="CheckBoxBorderBrushCheckedPointerOver" | ||
Color="Olive" /> | ||
<SolidColorBrush x:Key="CheckBoxBackgroundCheckedPointerOver" | ||
Color="Silver" /> | ||
|
||
<!-- Checked and pressed state --> | ||
<SolidColorBrush x:Key="CheckBoxCheckGlyphForegroundCheckedPressed" | ||
Color="Purple" /> | ||
<SolidColorBrush x:Key="CheckBoxBorderBrushCheckedPressed" | ||
Color="Aqua" /> | ||
<SolidColorBrush x:Key="CheckBoxBackgroundCheckedPressed" | ||
Color="Yellow" /> | ||
|
||
<!-- Unchecked state --> | ||
<SolidColorBrush x:Key="CheckBoxCheckGlyphForegroundUnchecked" | ||
Color="Black" /> | ||
<SolidColorBrush x:Key="CheckBoxBorderBrushUnchecked" | ||
Color="White" /> | ||
<SolidColorBrush x:Key="CheckBoxBackgroundUnchecked" | ||
Color="Gray" /> | ||
|
||
<!-- Unchecked and pointer over state --> | ||
<SolidColorBrush x:Key="CheckBoxCheckGlyphForegroundUncheckedPointerOver" | ||
Color="Blue" /> | ||
<SolidColorBrush x:Key="CheckBoxBorderBrushUncheckedPointerOver" | ||
Color="Orange" /> | ||
<SolidColorBrush x:Key="CheckBoxBackgroundUncheckedPointerOver" | ||
Color="Green" /> | ||
|
||
<!-- Unchecked and pressed state --> | ||
<SolidColorBrush x:Key="CheckBoxCheckGlyphForegroundUncheckedPressed" | ||
Color="Red" /> | ||
<SolidColorBrush x:Key="CheckBoxBorderBrushUncheckedPressed" | ||
Color="Cyan" /> | ||
<SolidColorBrush x:Key="CheckBoxBackgroundUncheckedPressed" | ||
Color="Pink" /> | ||
|
||
</ResourceDictionary> |
48 changes: 48 additions & 0 deletions
48
Uno.Gallery/Uno.Gallery.UWP/Views/ControlResourcesOverride/Fluent/RadioButton.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
|
||
<SolidColorBrush x:Key="RadioButtonForeground" | ||
Color="DarkGreen" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseStroke" | ||
Color="LightGreen" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseCheckedStroke" | ||
Color="DarkGreen" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseFill" | ||
Color="LightGreen" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseCheckedFill" | ||
Color="DarkGreen" /> | ||
|
||
<SolidColorBrush x:Key="RadioButtonForegroundPointerOver" | ||
Color="DarkRed" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseStrokePointerOver" | ||
Color="LightPink" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseCheckedStrokePointerOver" | ||
Color="DarkRed" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseFillPointerOver" | ||
Color="LightPink" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseCheckedFillPointerOver" | ||
Color="DarkRed" /> | ||
|
||
<SolidColorBrush x:Key="RadioButtonForegroundPressed" | ||
Color="DarkBlue" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseStrokePressed" | ||
Color="LightSteelBlue" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseCheckedStrokePressed" | ||
Color="DarkBlue" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseFillPressed" | ||
Color="LightSteelBlue" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseCheckedFillPressed" | ||
Color="DarkBlue" /> | ||
|
||
<SolidColorBrush x:Key="RadioButtonForegroundDisabled" | ||
Color="LightSlateGray" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseStrokeDisabled" | ||
Color="DarkGray" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseCheckedStrokeDisabled" | ||
Color="LightSlateGray" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseFillDisabled" | ||
Color="DarkGray" /> | ||
<SolidColorBrush x:Key="RadioButtonOuterEllipseCheckedFillDisabled" | ||
Color="LightSlateGray" /> | ||
|
||
</ResourceDictionary> |
24 changes: 24 additions & 0 deletions
24
Uno.Gallery/Uno.Gallery.UWP/Views/ControlResourcesOverride/Fluent/TextBox.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
|
||
<!-- Default State --> | ||
<SolidColorBrush x:Key="TextControlForeground" | ||
Color="Red" /> | ||
<SolidColorBrush x:Key="TextControlBackground" | ||
Color="Cyan" /> | ||
|
||
<!-- Pointer Over State --> | ||
<SolidColorBrush x:Key="TextControlButtonBackgroundPointerOver" | ||
Color="Orange" /> | ||
<SolidColorBrush x:Key="TextControlBackgroundPointerOver" | ||
Color="Navy" /> | ||
<SolidColorBrush x:Key="TextControlForegroundPointerOver" | ||
Color="Gray" /> | ||
|
||
<!-- Focused State --> | ||
<SolidColorBrush x:Key="TextControlForegroundFocused" | ||
Color="Yellow" /> | ||
<SolidColorBrush x:Key="TextControlBackgroundFocused" | ||
Color="RosyBrown" /> | ||
|
||
</ResourceDictionary> |
39 changes: 39 additions & 0 deletions
39
Uno.Gallery/Uno.Gallery.UWP/Views/ControlResourcesOverride/Material/Button.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
|
||
<SolidColorBrush x:Key="FilledButtonForeground" | ||
Color="DarkGreen" /> | ||
<SolidColorBrush x:Key="FilledButtonBackground" | ||
Color="LightGreen" /> | ||
<SolidColorBrush x:Key="FilledButtonBorderBrush" | ||
Color="DarkGreen" /> | ||
|
||
<SolidColorBrush x:Key="FilledButtonForegroundPointerOver" | ||
Color="DarkRed" /> | ||
<SolidColorBrush x:Key="FilledButtonBackgroundPointerOver" | ||
Color="LightPink" /> | ||
<SolidColorBrush x:Key="FilledButtonBorderBrushPointerOver" | ||
Color="DarkRed" /> | ||
|
||
<SolidColorBrush x:Key="FilledButtonForegroundPressed" | ||
Color="DarkBlue" /> | ||
<SolidColorBrush x:Key="FilledButtonBackgroundPressed" | ||
Color="LightSteelBlue" /> | ||
<SolidColorBrush x:Key="FilledButtonBorderBrushPressed" | ||
Color="DarkBlue" /> | ||
|
||
<SolidColorBrush x:Key="FilledButtonForegroundFocused" | ||
Color="AntiqueWhite" /> | ||
<SolidColorBrush x:Key="FilledButtonBackgroundFocused" | ||
Color="DarkMagenta" /> | ||
<SolidColorBrush x:Key="FilledButtonBorderBrushFocused" | ||
Color="AntiqueWhite" /> | ||
|
||
<SolidColorBrush x:Key="FilledButtonForegroundDisabled" | ||
Color="LightSlateGray" /> | ||
<SolidColorBrush x:Key="FilledButtonBackgroundDisabled" | ||
Color="DarkGray" /> | ||
<SolidColorBrush x:Key="FilledButtonBorderBrushDisabled" | ||
Color="LightSlateGray" /> | ||
|
||
</ResourceDictionary> |
Oops, something went wrong.