-
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.
Merge pull request #8314 from unoplatform/dev/jela/xbind-static-handler
- Loading branch information
Showing
6 changed files
with
217 additions
and
5 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
15 changes: 15 additions & 0 deletions
15
src/Uno.UI.Tests/Windows_UI_Xaml_Data/xBindTests/Controls/Binding_Static_Event.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 @@ | ||
<Page x:Class="Uno.UI.Tests.Windows_UI_Xaml_Data.xBindTests.Controls.Binding_Static_Event" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="using:Uno.UI.Tests.Windows_UI_Xaml_Data.xBindTests.Controls" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d"> | ||
|
||
<Grid> | ||
<CheckBox x:Name="myCheckBox" | ||
x:FieldModifier="public" | ||
Checked="{x:Bind local:Binding_Static_Event_Class.OnCheckedRaised}" | ||
Unchecked="{x:Bind local:Binding_Static_Event_Class.OnUncheckedRaised}"/> | ||
</Grid> | ||
</Page> |
49 changes: 49 additions & 0 deletions
49
src/Uno.UI.Tests/Windows_UI_Xaml_Data/xBindTests/Controls/Binding_Static_Event.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,49 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
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 Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 | ||
|
||
namespace Uno.UI.Tests.Windows_UI_Xaml_Data.xBindTests.Controls | ||
{ | ||
/// <summary> | ||
/// An empty page that can be used on its own or navigated to within a Frame. | ||
/// </summary> | ||
public sealed partial class Binding_Static_Event : Page | ||
{ | ||
public Binding_Static_Event() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
} | ||
|
||
public static class Binding_Static_Event_Class | ||
{ | ||
|
||
public static int CheckedRaised { get; private set; } | ||
public static int UncheckedRaised { get; private set; } | ||
|
||
public static void OnCheckedRaised() | ||
{ | ||
CheckedRaised++; | ||
} | ||
|
||
public static void OnUncheckedRaised(object sender, RoutedEventArgs args) | ||
{ | ||
UncheckedRaised++; | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
....UI.Tests/Windows_UI_Xaml_Data/xBindTests/Controls/Binding_Static_Event_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,22 @@ | ||
<Page x:Class="Uno.UI.Tests.Windows_UI_Xaml_Data.xBindTests.Controls.Binding_Static_Event_DataTemplate" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="using:Uno.UI.Tests.Windows_UI_Xaml_Data.xBindTests.Controls" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d"> | ||
|
||
<ContentControl x:Name="root" | ||
x:FieldModifier="public"> | ||
<ContentControl.ContentTemplate> | ||
<DataTemplate x:DataType="local:Binding_Static_Event_DataTemplate_Model"> | ||
<Grid> | ||
<CheckBox x:Name="myCheckBox" | ||
x:FieldModifier="public" | ||
Checked="{x:Bind local:Binding_Static_Event_DataTemplate_Model_Class.OnCheckedRaised}" | ||
Unchecked="{x:Bind local:Binding_Static_Event_DataTemplate_Model_Class.OnUncheckedRaised}"/> | ||
</Grid> | ||
</DataTemplate> | ||
</ContentControl.ContentTemplate> | ||
</ContentControl> | ||
</Page> |
50 changes: 50 additions & 0 deletions
50
....Tests/Windows_UI_Xaml_Data/xBindTests/Controls/Binding_Static_Event_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,50 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
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 Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 | ||
|
||
namespace Uno.UI.Tests.Windows_UI_Xaml_Data.xBindTests.Controls | ||
{ | ||
/// <summary> | ||
/// An empty page that can be used on its own or navigated to within a Frame. | ||
/// </summary> | ||
public sealed partial class Binding_Static_Event_DataTemplate : Page | ||
{ | ||
public Binding_Static_Event_DataTemplate() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
} | ||
|
||
public class Binding_Static_Event_DataTemplate_Model { } | ||
|
||
public static class Binding_Static_Event_DataTemplate_Model_Class | ||
{ | ||
public static int CheckedRaised { get; private set; } | ||
public static int UncheckedRaised { get; private set; } | ||
|
||
internal static void OnCheckedRaised() | ||
{ | ||
CheckedRaised++; | ||
} | ||
|
||
internal static void OnUncheckedRaised(object sender, RoutedEventArgs args) | ||
{ | ||
UncheckedRaised++; | ||
} | ||
} | ||
} |
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