blob: 0848772ca624ab80cb27d61d7cc08787e2bd3aad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
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
{
public static readonly DependencyProperty ToolbarForegroundProperty = DependencyProperty.Register(nameof(ToolbarForeground), typeof(Brush), typeof(TabsControl), new PropertyMetadata(default(Brush)));
public static readonly DependencyProperty ToolbarBackgroundProperty = DependencyProperty.Register(nameof(ToolbarBackground), typeof(Brush), typeof(TabsControl), new PropertyMetadata(default(Brush)));
public Brush ToolbarBackground
{
get { return (Brush)GetValue(ToolbarBackgroundProperty); }
set { SetValue(ToolbarBackgroundProperty, value); }
}
public Brush ToolbarForeground
{
get { return (Brush)GetValue(ToolbarForegroundProperty); }
set { SetValue(ToolbarForegroundProperty, value); }
}
}
}
|