Skip to content

Instantly share code, notes, and snippets.

@BrianJVarley
Last active August 29, 2015 14:20
Show Gist options
  • Save BrianJVarley/85bb86b3c0497438f9b9 to your computer and use it in GitHub Desktop.
Save BrianJVarley/85bb86b3c0497438f9b9 to your computer and use it in GitHub Desktop.
<Page x:Class="LC_Points.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:converter="using:LC_Points.Converter"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:local="using:LC_Points"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
DataContext="{Binding Source={StaticResource Locator}}"
mc:Ignorable="d">
<Page.Resources>
<converter:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<converter:BoolToNonVisibilityConverter x:Key="BoolToNonVisibilityConverter" />
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40*" />
<RowDefinition Height="20*" />
<RowDefinition Height="30*" />
<RowDefinition Height="30*" />
<RowDefinition Height="20*" />
<RowDefinition Height="20*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<!-- TitlePanel contains the name of the application and page title -->
<StackPanel x:Name="TitlePanel"
Grid.Row="0"
Margin="12,17,0,28">
<TextBlock Style="{StaticResource SubheaderTextBlockStyle}" Text="LC POINTS" />
<TextBlock Margin="9,-7,0,0"
Foreground="DarkGreen"
Style="{StaticResource HeaderTextBlockStyle}"
Text="Home" />
</StackPanel>
<ComboBox x:Name="subjectCmbBx"
Grid.Row="1"
Grid.ColumnSpan="2"
Width="174"
HorizontalAlignment="Left"
VerticalAlignment="Top"
DisplayMemberPath="Subject"
Header="Subjects"
PlaceholderText="Pick a subject"
SelectedItem="{Binding SelectedSubject,
Mode=TwoWay}" />
<ComboBox x:Name="ordinaryGradeCmbBx"
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Width="170"
HorizontalAlignment="Right"
DisplayMemberPath="Key"
Header="Grades"
ItemsSource="{Binding OrdinaryGradePointKV}"
PlaceholderText="Pick a grade"
SelectedValue="{Binding SelectedOrdinaryGrade,
Mode=TwoWay}"
Visibility="{Binding IsHigher,
Mode=TwoWay,
Converter={StaticResource BoolToNonVisibilityConverter}}" />
<ComboBox x:Name="higherGradeCmbBx"
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Width="170"
HorizontalAlignment="Right"
DisplayMemberPath="Key"
Header="Grades"
ItemsSource="{Binding HigherGradePointKV}"
PlaceholderText="Pick a grade"
SelectedValue="{Binding SelectedHigherGrade,
Mode=TwoWay}"
Visibility="{Binding IsHigher,
Mode=TwoWay,
Converter={StaticResource BoolToVisibilityConverter}}" />
<Button x:Name="addGradeBtn"
Grid.Row="2"
HorizontalAlignment="Left"
Command="{Binding Path=AddGradeCommand}"
Content="Add Grade" />
<ToggleButton x:Name="higherTglBtn"
Grid.Row="3"
HorizontalAlignment="Left"
Content="Higher"
IsChecked="{Binding IsHigher,
Mode=TwoWay}" />
<ToggleButton x:Name="ordinaryTglBtn"
Grid.Row="3"
Grid.ColumnSpan="2"
HorizontalAlignment="Center"
Content="Ordinary"
IsChecked="{Binding IsOrdinary,
Mode=TwoWay}" />
<TextBlock Grid.Row="5"
Grid.ColumnSpan="3"
Width="212"
Height="54"
HorizontalAlignment="Center"
Text="{Binding TotalPoints,
Mode=TwoWay}"
TextWrapping="Wrap" />
</Grid>
<Page.BottomAppBar>
<CommandBar x:Name="appBar" IsSticky="True">
<CommandBar.PrimaryCommands>
<AppBarButton x:Name="ClearAppBarButton"
Command="{Binding Path=ClearGradesCommand}"
Icon="Delete"
IsCompact="False"
Label="Clear All" />
<AppBarButton x:Name="ViewListAppBarButton"
Icon="ViewAll"
IsCompact="False"
Label="View">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Click">
<Core:NavigateToPageAction TargetPage="LC_Points.View.ViewSubjectGradePage" />
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</AppBarButton>
<AppBarButton x:Name="AboutAppBarButton"
Icon="Help"
IsCompact="False"
Label="About">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Click">
<Core:NavigateToPageAction TargetPage="LC_Points.View.AboutPage" />
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</AppBarButton>
</CommandBar.PrimaryCommands>
<CommandBar.SecondaryCommands>
<AppBarButton Label="Share score!" />
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
</Page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment