forked from fuse-open/fuse-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainView.ux
53 lines (46 loc) · 2.08 KB
/
MainView.ux
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
<App>
<ClientPanel Color="#AAA">
<Panel Dock="Top">
<!-- PageIndicator is a StackPanel, so we can set those properties -->
<PageIndicator Navigation="mainNav" Orientation="Horizontal" ItemSpacing="10"
Alignment="Center" Margin="5">
<!-- The "Dot" template is instantiated for each Page in the Navigation -->
<DockPanel ux:Template="Dot" Color="#CCC" Padding="10,5">
<Rectangle Layer="Background">
<Stroke Alignment="Outside" Width="2" Color="#0000" ux:Name="theStroke"/>
</Rectangle>
<!-- Get the highlight color of the page, stored as a Resource on the page -->
<Circle Dock="Left" Margin="0,0,10,0" BoxSizing="FillAspect" Color="{Page Highlight}"
Opacity="0.2" ux:Name="theDot"/>
<!-- The Page.Title is implicitly a Resource of the page -->
<Text Color="#000" Value="{Page Title}"/>
<!-- Using activating animation to show partial transitions as the user is swiping -->
<ActivatingAnimation>
<Change theStroke.Color="#008F"/>
</ActivatingAnimation>
<!-- The threshold on this WhileActive ensures the trigger will only be active on one tab at a time -->
<WhileActive Threshold="0.5">
<Change theDot.Opacity="1" Duration="0.3"/>
</WhileActive>
<Clicked>
<!-- {Page Visual} is a special binding which refers to the page itself -->
<NavigateTo Target="{Page Visual}"/>
</Clicked>
</DockPanel>
</PageIndicator>
</Panel>
<Page ux:Class="MyPage" Color="#AAA">
<float4 ux:Property="Highlight"/>
<!-- This lets us bind our property to a Resource, so the Dot can reference it as {Page Highlight} -->
<ResourceFloat4 Key="Highlight" Value="{ReadProperty this.Highlight}"/>
<Rectangle Margin="25" CornerRadius="50" Color="{ReadProperty this.Highlight}">
<Text Color="#000" Value="{ReadProperty this.Title}" Alignment="Center"/>
</Rectangle>
</Page>
<PageControl ux:Name="mainNav">
<MyPage Title="One" Highlight="#AFA"/>
<MyPage Title="Two" Highlight="#AFF"/>
<MyPage Title="Three" Highlight="#FFA"/>
</PageControl>
</ClientPanel>
</App>