Skip to content

Commit

Permalink
chore: workaround for ResourceKeyDefinition on fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoy312 committed Oct 12, 2023
1 parent e652a7f commit b54230b
Show file tree
Hide file tree
Showing 23 changed files with 61 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;

namespace Uno.Themes.WinUI.Markup;

// temporary workaround for ResourceKeyDefinition not applicable on field members.
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
public sealed class ResourceKeyDefinitionAttribute : Attribute
{
public ResourceKeyDefinitionAttribute(Type propertyType, string key)
{
this.PropertyType = propertyType;
this.Key = key;
}

public string Key { get; }
public Type PropertyType { get; }
public Type? TargetType { get; set; }
}
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/Button.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/CalendarView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/CheckBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/ComboBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/CommandBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/ContentDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/DatePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/HyperlinkButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/PasswordBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/ProgressBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/ProgressRing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/RadioButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/RatingControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/Slider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/TextBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/TextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/ToggleButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
2 changes: 2 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/ToggleSwitch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Uno.Extensions.Markup;
using Uno.Extensions.Markup.Internals;

using ResourceKeyDefinitionAttribute = Uno.Themes.WinUI.Markup.ResourceKeyDefinitionAttribute;

namespace Uno.Themes.Markup
{
public static partial class Theme
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="MSBuild.Sdk.Extras/3.0.44">
<Project Sdk="MSBuild.Sdk.Extras/3.0.44">

<!--
Adding project references to this project requires some manual adjustments.
Expand Down

0 comments on commit b54230b

Please sign in to comment.