diff --git a/NControl.Controls/NControl.Controls/WizardLayout.cs b/NControl.Controls/NControl.Controls/WizardLayout.cs
index 94fdb43..6857f8c 100644
--- a/NControl.Controls/NControl.Controls/WizardLayout.cs
+++ b/NControl.Controls/NControl.Controls/WizardLayout.cs
@@ -5,6 +5,7 @@
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Linq;
+using System.Collections.ObjectModel;
namespace NControl.Controls
{
@@ -15,15 +16,9 @@ public class WizardLayout: Grid
{
#region Private Members
- ///
- /// The page.
- ///
- private readonly WizardStackLayout _contentStack;
-
- ///
- /// The pager.
- ///
- private readonly PagingView _pager;
+ readonly WizardStackLayout _contentStack;
+ readonly PagingView _pager;
+ readonly ObservableCollection _pages = new ObservableCollection();
#endregion
@@ -32,6 +27,8 @@ public class WizardLayout: Grid
///
public WizardLayout()
{
+ _pages.CollectionChanged += PagesChanged;
+
// Wrapping layout
var layout = new RelativeLayout();
Children.Add(layout);
@@ -83,35 +80,14 @@ public int Page
}
}
- ///
- /// The pages property.
- ///
- public static BindableProperty PagesProperty = BindableProperty.Create(nameof(Pages),
- typeof(IEnumerable), typeof(WizardLayout), null, propertyChanged: (bindable, oldValue, newValue) => {
- var ctrl = (WizardLayout)bindable;
- ctrl.Pages = (IEnumerable)newValue;
- });
-
///
/// Gets or sets the pages.
///
/// The pages.
- public IEnumerable Pages
- {
- get { return (IEnumerable)GetValue(PagesProperty); }
- set
- {
- if (Pages != null && Pages is INotifyCollectionChanged)
- (Pages as INotifyCollectionChanged).CollectionChanged -= PagesChanged;
-
- SetValue(PagesProperty, value);
-
- if (Pages != null && Pages is INotifyCollectionChanged)
- (Pages as INotifyCollectionChanged).CollectionChanged += PagesChanged;
-
- UpdatePages();
- }
- }
+ public IList Pages
+ {
+ get { return _pages; }
+ }
#endregion
diff --git a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/MyApp.cs b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/MyApp.cs
index 29b3745..3918499 100644
--- a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/MyApp.cs
+++ b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/MyApp.cs
@@ -27,6 +27,7 @@ public MyApp ()
new SvgImagePage(),
new CalendarPage(),
new WizardPage(),
+ new WizardPageXaml(),
new RepeaterPage(),
};
diff --git a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/NControl.Controls.Demo.FormsApp.csproj b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/NControl.Controls.Demo.FormsApp.csproj
index ef46ee1..1697afb 100644
--- a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/NControl.Controls.Demo.FormsApp.csproj
+++ b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/NControl.Controls.Demo.FormsApp.csproj
@@ -52,6 +52,9 @@
+
+ WizardPageXaml.xaml
+
@@ -65,6 +68,9 @@
+
+ MSBuild:UpdateDesignTimeXaml
+
diff --git a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPage.cs b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPage.cs
index b5a958d..0d20eae 100644
--- a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPage.cs
+++ b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPage.cs
@@ -14,8 +14,9 @@ protected override void OnAppearing ()
{
base.OnAppearing ();
- var wizard = new WizardLayout ();
- wizard.Pages = new View[]{
+ WizardLayout wizard = null;
+ wizard = new WizardLayout {
+ Pages = {
new Button {
Command = new Command((obj)=>wizard.Page++),
Text = "Page 2",
@@ -34,6 +35,7 @@ protected override void OnAppearing ()
new Button {
Text = "Done",
}
+ }
};
Content = wizard;
diff --git a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPageXaml.xaml b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPageXaml.xaml
new file mode 100644
index 0000000..119a76c
--- /dev/null
+++ b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPageXaml.xaml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPageXaml.xaml.cs b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPageXaml.xaml.cs
new file mode 100644
index 0000000..fe5b148
--- /dev/null
+++ b/NControl.ControlsDemo/NControl.Controls.Demo.FormsApp/WizardPageXaml.xaml.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+
+using Xamarin.Forms;
+
+namespace NControl.Controls.Demo.FormsApp
+{
+ public partial class WizardPageXaml : ContentPage
+ {
+ public WizardPageXaml()
+ {
+ InitializeComponent();
+ Title = "WizardLayout XAML";
+ }
+ }
+}