-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(XamlFileGenerator): Generate literal properties for ResourceDicti…
…onary subclasses
- Loading branch information
Showing
9 changed files
with
144 additions
and
4 deletions.
There are no files selected for viewing
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
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
5 changes: 5 additions & 0 deletions
5
src/Uno.UI.Tests/App/Xaml/Subclassed_Dictionary_With_Property.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,5 @@ | ||
<ResourceDictionary x:Class="Uno.UI.Tests.App.Xaml.Subclassed_Dictionary_With_Property" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
|
||
</ResourceDictionary> |
62 changes: 62 additions & 0 deletions
62
src/Uno.UI.Tests/App/Xaml/Subclassed_Dictionary_With_Property.xaml.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,62 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using Uno.UI.Tests.App.Views; | ||
using Uno.UI.Tests.ViewLibrary; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
using Windows.Networking.Sockets; | ||
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; | ||
|
||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 | ||
|
||
namespace Uno.UI.Tests.App.Xaml | ||
{ | ||
/// <summary> | ||
/// An empty page that can be used on its own or navigated to within a Frame. | ||
/// </summary> | ||
public sealed partial class Subclassed_Dictionary_With_Property : ResourceDictionary | ||
{ | ||
public string Test | ||
{ | ||
get => (string)GetValue(TestProperty); | ||
set => SetValue(TestProperty, value); | ||
} | ||
|
||
public static DependencyProperty TestProperty { get; } = | ||
DependencyProperty.Register( | ||
nameof(Test), | ||
typeof(string), | ||
typeof(Subclassed_Dictionary_With_Property), | ||
new PropertyMetadata(OnPropertyChanged)); | ||
|
||
private static void OnPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args) | ||
{ | ||
if (dependencyObject is Subclassed_Dictionary_With_Property rd) | ||
{ | ||
if (!rd.ContainsKey("TestKey")) | ||
{ | ||
rd.Add("TestKey", args.NewValue as string); | ||
} | ||
else | ||
{ | ||
rd["TestKey"] = args.NewValue as string; | ||
} | ||
} | ||
} | ||
|
||
public Subclassed_Dictionary_With_Property() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
....Tests/App/Xaml/Test_Control_With_Subclassed_ResourceDictionary_With_Custom_Property.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,17 @@ | ||
<UserControl | ||
x:Class="Uno.UI.Tests.App.Xaml.Test_Control_With_Subclassed_ResourceDictionary_With_Custom_Property" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:Uno.UI.Tests.App.Xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
d:DesignHeight="300" | ||
d:DesignWidth="400"> | ||
<UserControl.Resources> | ||
<local:Subclassed_Dictionary_With_Property Test="Test123"/> | ||
</UserControl.Resources> | ||
<Grid> | ||
|
||
</Grid> | ||
</UserControl> |
27 changes: 27 additions & 0 deletions
27
...sts/App/Xaml/Test_Control_With_Subclassed_ResourceDictionary_With_Custom_Property.xaml.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,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
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; | ||
|
||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 | ||
|
||
namespace Uno.UI.Tests.App.Xaml | ||
{ | ||
public sealed partial class Test_Control_With_Subclassed_ResourceDictionary_With_Custom_Property : UserControl | ||
{ | ||
public Test_Control_With_Subclassed_ResourceDictionary_With_Custom_Property() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} | ||
} |
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