-
Notifications
You must be signed in to change notification settings - Fork 762
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(xBind): Fix xBind to other control without code-behind base class
- Loading branch information
1 parent
eb59473
commit 76b2dba
Showing
6 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
....UI.Tests/Windows_UI_Xaml_Data/xBindTests/Controls/xBind_UserControl_To_OtherControl.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,14 @@ | ||
<UserControl | ||
x:Class="Uno.UI.Tests.Windows_UI_Xaml_Data.xBindTests.Controls.xBind_UserControl_To_OtherControl" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:Uno.UI.Tests.Windows_UI_Xaml_Data.xBindTests.Controls" | ||
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"> | ||
|
||
<local:xBind_UserControl_To_OtherControl_Inner | ||
MyProperty="{x:Bind MyProperty, Mode=OneWay}" /> | ||
</UserControl> |
40 changes: 40 additions & 0 deletions
40
....Tests/Windows_UI_Xaml_Data/xBindTests/Controls/xBind_UserControl_To_OtherControl.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,40 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
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.Windows_UI_Xaml_Data.xBindTests.Controls | ||
{ | ||
#pragma warning disable UXAML0002 | ||
public sealed partial class xBind_UserControl_To_OtherControl /* : UserControl: Don't specify the base type so x:Bind generator lookups uses the XAML control type */ | ||
#pragma warning restore UXAML0002 | ||
{ | ||
public xBind_UserControl_To_OtherControl() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
public string MyProperty | ||
{ | ||
get { return (string)GetValue(MyPropertyProperty); } | ||
set { SetValue(MyPropertyProperty, value); } | ||
} | ||
|
||
// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... | ||
public static readonly DependencyProperty MyPropertyProperty = | ||
DependencyProperty.Register("MyProperty", typeof(string), typeof(xBind_UserControl_To_OtherControl), new PropertyMetadata("Default string")); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...sts/Windows_UI_Xaml_Data/xBindTests/Controls/xBind_UserControl_To_OtherControl_Inner.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,15 @@ | ||
<UserControl | ||
x:Class="Uno.UI.Tests.Windows_UI_Xaml_Data.xBindTests.Controls.xBind_UserControl_To_OtherControl_Inner" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:Uno.UI.Tests.Windows_UI_Xaml_Data.xBindTests.Controls" | ||
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"> | ||
|
||
<Grid> | ||
<TextBlock x:Name="tb1" x:FieldModifier="public" Text="{x:Bind MyProperty, Mode=OneWay}" /> | ||
</Grid> | ||
</UserControl> |
40 changes: 40 additions & 0 deletions
40
.../Windows_UI_Xaml_Data/xBindTests/Controls/xBind_UserControl_To_OtherControl_Inner.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,40 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
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.Windows_UI_Xaml_Data.xBindTests.Controls | ||
{ | ||
#pragma warning disable UXAML0002 | ||
public sealed partial class xBind_UserControl_To_OtherControl_Inner /* : UserControl: Don't specify the base type so x:Bind generator lookups uses the XAML control type */ | ||
#pragma warning restore UXAML0002 | ||
{ | ||
public xBind_UserControl_To_OtherControl_Inner() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
public string MyProperty | ||
{ | ||
get { return (string)GetValue(MyPropertyProperty); } | ||
set { SetValue(MyPropertyProperty, value); } | ||
} | ||
|
||
// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... | ||
public static readonly DependencyProperty MyPropertyProperty = | ||
DependencyProperty.Register("MyProperty", typeof(string), typeof(xBind_UserControl_To_OtherControl_Inner), new PropertyMetadata("Default string")); | ||
} | ||
} |
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