forked from unoplatform/uno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(xBind): Enhanced support for x:Bind casting expressions
- Loading branch information
1 parent
46c1796
commit 4521b63
Showing
8 changed files
with
219 additions
and
24 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
20 changes: 20 additions & 0 deletions
20
src/Uno.UI.Tests/Windows_UI_Xaml_Data/xBindTests/Controls/Binding_TypeCast.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,20 @@ | ||
<UserControl | ||
x:Class="Uno.UI.Tests.Windows_UI_Xaml_Data.xBindTests.Controls.Binding_TypeCast" | ||
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"> | ||
<Grid> | ||
<TextBlock x:Name="tb01" | ||
x:FieldModifier="public" | ||
Text="{x:Bind (x:String)MyObject}"/> | ||
<TextBlock x:Name="tb02" | ||
x:FieldModifier="public" | ||
Text="{x:Bind MyMethod((x:String)MyObject)}"/> | ||
<TextBlock x:Name="tb03" | ||
x:FieldModifier="public" | ||
Text="{x:Bind MyMethod2((x:String)MyObject, (x:String)MyObject)}" /> | ||
<TextBlock x:Name="tb04" | ||
x:FieldModifier="public" | ||
Tag="{x:Bind ((x:String)MyObject).Length}" /> | ||
</Grid> | ||
</UserControl> |
35 changes: 35 additions & 0 deletions
35
src/Uno.UI.Tests/Windows_UI_Xaml_Data/xBindTests/Controls/Binding_TypeCast.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,35 @@ | ||
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.Windows_UI_Xaml_Data.xBindTests.Controls | ||
{ | ||
public sealed partial class Binding_TypeCast : UserControl | ||
{ | ||
public Binding_TypeCast() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
public object MyObject => "42"; | ||
|
||
public string MyMethod(string myString) | ||
=> myString; | ||
|
||
public string MyMethod2(string myString, string myString2) | ||
=> myString + myString2; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/Uno.UI.Tests/Windows_UI_Xaml_Data/xBindTests/Controls/Binding_TypeCast_DataTemplate.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,28 @@ | ||
<UserControl | ||
x:Class="Uno.UI.Tests.Windows_UI_Xaml_Data.xBindTests.Controls.Binding_TypeCast_DataTemplate" | ||
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"> | ||
<ContentControl x:Name="root" | ||
x:FieldModifier="public"> | ||
<ContentControl.ContentTemplate> | ||
<DataTemplate x:DataType="local:Binding_TypeCast_DataTemplate_Data"> | ||
<StackPanel> | ||
<TextBlock x:Name="tb01" | ||
x:FieldModifier="public" | ||
Text="{x:Bind (x:String)MyObject}" /> | ||
<TextBlock x:Name="tb02" | ||
x:FieldModifier="public" | ||
Text="{x:Bind MyMethod((x:String)MyObject)}" /> | ||
<TextBlock x:Name="tb03" | ||
x:FieldModifier="public" | ||
Text="{x:Bind MyMethod2((x:String)MyObject, (x:String)MyObject)}" /> | ||
<TextBlock x:Name="tb04" | ||
x:FieldModifier="public" | ||
Tag="{x:Bind ((x:String)MyObject).Length}" /> | ||
|
||
</StackPanel> | ||
</DataTemplate> | ||
</ContentControl.ContentTemplate> | ||
</ContentControl> | ||
</UserControl> |
38 changes: 38 additions & 0 deletions
38
...o.UI.Tests/Windows_UI_Xaml_Data/xBindTests/Controls/Binding_TypeCast_DataTemplate.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,38 @@ | ||
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.Windows_UI_Xaml_Data.xBindTests.Controls | ||
{ | ||
public sealed partial class Binding_TypeCast_DataTemplate : UserControl | ||
{ | ||
public Binding_TypeCast_DataTemplate() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} | ||
|
||
public partial class Binding_TypeCast_DataTemplate_Data | ||
{ | ||
public object MyObject => "42"; | ||
|
||
public string MyMethod(string myString) | ||
=> myString; | ||
|
||
public string MyMethod2(string myString, string myString2) | ||
=> myString + myString2; | ||
} | ||
} |
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