Skip to content

Commit d3435a8

Browse files
committed
Update test UI to allow testing for binding
1 parent dd6bfd3 commit d3435a8

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

tests/PagerControlPolyFill.TestApp/App.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ public App()
4141
/// <param name="args">Details about the launch request and process.</param>
4242
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
4343
{
44-
m_window = new MainWindow();
44+
m_window = new Window();
4545
m_window.Activate();
46+
m_window.Content = new MainPage();
4647
}
4748

4849
private Window m_window;

tests/PagerControlPolyFill.TestApp/MainWindow.xaml renamed to tests/PagerControlPolyFill.TestApp/MainPage.xaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Window
3-
x:Class="PagerControlPolyfill.TestApp.MainWindow"
2+
<Page
3+
x:Class="PagerControlPolyfill.TestApp.MainPage"
44
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
55
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -59,6 +59,9 @@
5959
DisplayMode="ButtonPanel"
6060
ButtonPanelAlwaysShowFirstLastPageIndex="True"/>
6161

62+
<TextBlock Text="Binding tester"/>
63+
<pager:PagerControl SelectedPageIndex="{x:Bind SelectedPageIndexBind, Mode=TwoWay}" NumberOfPages="20"/>
64+
6265
</StackPanel>
6366

6467
<ScrollViewer Grid.Column="1" HorizontalScrollMode="Enabled" HorizontalScrollBarVisibility="Visible">
@@ -257,4 +260,4 @@
257260
</Grid>
258261
</ScrollViewer>
259262
</Grid>
260-
</Window>
263+
</Page>

tests/PagerControlPolyFill.TestApp/MainWindow.xaml.cs renamed to tests/PagerControlPolyFill.TestApp/MainPage.xaml.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ namespace PagerControlPolyfill.TestApp
2222
/// <summary>
2323
/// An empty window that can be used on its own or navigated to within a Frame.
2424
/// </summary>
25-
public sealed partial class MainWindow : Window
25+
public sealed partial class MainPage : Page
2626
{
27-
public MainWindow()
27+
public MainPage()
2828
{
2929
this.InitializeComponent();
3030
RootGrid.Loaded += OnLoad;
@@ -38,6 +38,14 @@ public MainWindow()
3838
Button nextPageButton;
3939
Button lastPageButton;
4040

41+
public int SelectedPageIndexBind
42+
{
43+
get { return (int)GetValue(SelectedPageIndexBindProperty); }
44+
set { SetValue(SelectedPageIndexBindProperty, value); }
45+
}
46+
public static readonly DependencyProperty SelectedPageIndexBindProperty =
47+
DependencyProperty.Register("SelectedPageIndexBind", typeof(int), typeof(MainPage), new PropertyMetadata(5));
48+
4149
private void OnLoad(object sender, RoutedEventArgs args)
4250
{
4351
PagerDisplayModeComboBox.SelectionChanged += OnDisplayModeChanged;

0 commit comments

Comments
 (0)