/
MainPage.xaml
executable file
·87 lines (79 loc) · 5.31 KB
/
MainPage.xaml
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<phone:PhoneApplicationPage
x:Class="Glossary.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<phone:PhoneApplicationPage.Resources>
<ResourceDictionary>
<DataTemplate x:Key="TermItem">
<Button Style="{StaticResource EmptyButtonStyle}" >
<Grid Height="120" toolkit:TiltEffect.IsTiltEnabled="True" HorizontalAlignment="Stretch" CacheMode="BitmapCache">
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu IsZoomEnabled="False">
<toolkit:MenuItem Header="edit term" DataContext="{Binding Value}" toolkit:TiltEffect.IsTiltEnabled="True" Click="MenuItem_Edit_Term_Click"/>
<toolkit:MenuItem Header="remove term" DataContext="{Binding Value}" toolkit:TiltEffect.IsTiltEnabled="True" Click="MenuItem_Remove_Term_Click"/>
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
<StackPanel Orientation="Vertical" Margin="0,0,0,10">
<TextBlock Text="{Binding Term}" FontSize="{StaticResource PhoneFontSizeMediumLarge}" Foreground="#FF5B92E5" TextAlignment="Left" VerticalAlignment="Top" Height="30" TextWrapping="Wrap"/>
<TextBlock Text="{Binding Description}" FontSize="{StaticResource PhoneFontSizeSmall}" Foreground="{StaticResource PhoneSubtleBrush}" TextAlignment="Left" VerticalAlignment="Top" Height="80" TextWrapping="Wrap"/>
</StackPanel>
</Grid>
</Button>
</DataTemplate>
<Style x:Key="TermItemsControlStyle" TargetType="ListBox">
<Setter Property="ListBox.ItemTemplate" Value="{StaticResource TermItem}" />
<Setter Property="Width" Value="432" />
<Setter Property="Margin" Value="0,0,-12,0" />
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="ListBox.ItemContainerStyle">
<Setter.Value>
<Style TargetType="ListBoxItem">
<Setter Property="Height" Value="120"/>
</Style>
</Setter.Value>
</Setter>
<Setter Property="ListBox.ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</phone:PhoneApplicationPage.Resources>
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="PageTitle" Text="glossary" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<ListBox HorizontalAlignment="Left" Name="GlossaryListBox" VerticalAlignment="Top" Style="{StaticResource TermItemsControlStyle}" Opacity="1" ItemsSource="{Binding Data}"/>
</Grid>
</Grid>
<!--Sample code showing usage of ApplicationBar-->
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Opacity="0.8">
<shell:ApplicationBarIconButton IconUri="/icons/appbar.add.rest.png" Text="add" Click="ApplicationBarIconButton_Add_Click"/>
<shell:ApplicationBarIconButton IconUri="/icons/sort_term.png" Text="sort term" Click="ApplicationBarIconButton_Sort_Term_Click"/>
<shell:ApplicationBarIconButton IconUri="/icons/sort_description.png" Text="sort description" Click="ApplicationBarIconButton_Sort_Description_Click"/>
<shell:ApplicationBarIconButton IconUri="/icons/about.png" Text="about" Click="ApplicationBarIconButton_About_Click"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>