diff options
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT.Tablet/TabsControl.cs')
-rw-r--r-- | Xamarin.Forms.Platform.WinRT.Tablet/TabsControl.cs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.WinRT.Tablet/TabsControl.cs b/Xamarin.Forms.Platform.WinRT.Tablet/TabsControl.cs new file mode 100644 index 00000000..d98a27a0 --- /dev/null +++ b/Xamarin.Forms.Platform.WinRT.Tablet/TabsControl.cs @@ -0,0 +1,50 @@ +using System; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace Xamarin.Forms.Platform.WinRT +{ + public class TabSelectedEventArgs + : EventArgs + { + public TabSelectedEventArgs(Page tab) + { + if (tab == null) + throw new ArgumentNullException("tab"); + + Tab = tab; + } + + public Page Tab { get; private set; } + } + + public class TabButton + : Windows.UI.Xaml.Controls.Button + { + protected override void OnApplyTemplate() + { + base.OnApplyTemplate(); + Click += OnClick; + } + + void OnClick(object sender, RoutedEventArgs routedEventArgs) + { + var page = DataContext as Page; + if (page == null) + return; + + var parent = page.RealParent as TabbedPage; + if (parent == null) + return; + + var renderer = Platform.GetRenderer(parent) as TabbedPageRenderer; + if (renderer != null) + renderer.OnTabSelected(page); + } + } + + public class TabsControl + : ItemsControl + { + } +}
\ No newline at end of file |