Permalink
Browse files

hubcontrol-getting-started blog post

  • Loading branch information...
1 parent fb1e167 commit 60daa81bbaf11eed580297f1ba9e8d7ae951441e @mikoskinen committed Jun 27, 2013
@@ -0,0 +1,48 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Express 2013 for Windows
+VisualStudioVersion = 12.0.20617.1 PREVIEW
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hubcontrol-getting-started", "hubcontrol-getting-started\hubcontrol-getting-started.csproj", "{77E0D604-01FA-4519-90EE-094B835A0B9C}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|ARM = Debug|ARM
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|ARM = Release|ARM
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Debug|ARM.ActiveCfg = Debug|ARM
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Debug|ARM.Build.0 = Debug|ARM
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Debug|ARM.Deploy.0 = Debug|ARM
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Debug|x64.ActiveCfg = Debug|x64
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Debug|x64.Build.0 = Debug|x64
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Debug|x64.Deploy.0 = Debug|x64
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Debug|x86.ActiveCfg = Debug|x86
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Debug|x86.Build.0 = Debug|x86
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Debug|x86.Deploy.0 = Debug|x86
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Release|ARM.ActiveCfg = Release|ARM
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Release|ARM.Build.0 = Release|ARM
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Release|ARM.Deploy.0 = Release|ARM
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Release|x64.ActiveCfg = Release|x64
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Release|x64.Build.0 = Release|x64
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Release|x64.Deploy.0 = Release|x64
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Release|x86.ActiveCfg = Release|x86
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Release|x86.Build.0 = Release|x86
+ {77E0D604-01FA-4519-90EE-094B835A0B9C}.Release|x86.Deploy.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
@@ -0,0 +1,48 @@
+<Application
+ x:Class="hubcontrol_getting_started.App"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:local="using:hubcontrol_getting_started">
+
+ <Application.Resources>
+
+ <LinearGradientBrush x:Key="BackgroundBrush"
+ EndPoint="2,2"
+ StartPoint="6,6"
+ SpreadMethod="Repeat"
+ MappingMode="Absolute" Opacity="0.26">
+ <GradientStop Color="Blue" Offset="0"/>
+ <GradientStop Color="#50C4FE" Offset="0.1"/>
+ </LinearGradientBrush>
+
+ <DataTemplate x:Key="Standard130ItemTemplate">
+ <Grid Height="110" Margin="6">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto"/>
+ <ColumnDefinition Width="*"/>
+ </Grid.ColumnDefinitions>
+ <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" Width="110" Height="110">
+ <Image Source="{Binding Image}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>
+ </Border>
+ <StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,0,0,0">
+ <TextBlock Text="{Binding Title}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap"/>
+ <TextBlock Text="{Binding Subtitle}" Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap"/>
+ <TextBlock Text="{Binding Description}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60" TextWrapping="Wrap"/>
+ </StackPanel>
+ </Grid>
+ </DataTemplate>
+
+ <DataTemplate x:Key="Standard250x250ItemTemplate">
+ <Grid HorizontalAlignment="Left" Width="250" Height="250">
+ <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}">
+ <Image Source="{Binding Image}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>
+ </Border>
+ <StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}">
+ <TextBlock Text="{Binding Title}" Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}" Style="{StaticResource TitleTextBlockStyle}" Height="60" Margin="15,0,15,0"/>
+ <TextBlock Text="{Binding Subtitle}" Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap" Margin="15,0,15,10"/>
+ </StackPanel>
+ </Grid>
+ </DataTemplate>
+
+ </Application.Resources>
+</Application>
@@ -0,0 +1,98 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.ApplicationModel;
+using Windows.ApplicationModel.Activation;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Navigation;
+
+// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
+
+namespace hubcontrol_getting_started
+{
+ /// <summary>
+ /// Provides application-specific behavior to supplement the default Application class.
+ /// </summary>
+ sealed partial class App : Application
+ {
+ /// <summary>
+ /// Initializes the singleton application object. This is the first line of authored code
+ /// executed, and as such is the logical equivalent of main() or WinMain().
+ /// </summary>
+ public App()
+ {
+ this.InitializeComponent();
+ this.Suspending += OnSuspending;
+ }
+
+ /// <summary>
+ /// Invoked when the application is launched normally by the end user. Other entry points
+ /// will be used such as when the application is launched to open a specific file.
+ /// </summary>
+ /// <param name="e">Details about the launch request and process.</param>
+ protected override void OnLaunched(LaunchActivatedEventArgs e)
+ {
+
+#if DEBUG
+ if (System.Diagnostics.Debugger.IsAttached)
+ {
+ //this.DebugSettings.EnableFrameRateCounter = true;
+ }
+#endif
+
+ Frame rootFrame = Window.Current.Content as Frame;
+
+ // Do not repeat app initialization when the Window already has content,
+ // just ensure that the window is active
+ if (rootFrame == null)
+ {
+ // Create a Frame to act as the navigation context and navigate to the first page
+ rootFrame = new Frame();
+
+ if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
+ {
+ //TODO: Load state from previously suspended application
+ }
+
+ // Place the frame in the current Window
+ Window.Current.Content = rootFrame;
+ }
+
+ if (rootFrame.Content == null)
+ {
+ // When the navigation stack isn't restored navigate to the first page,
+ // configuring the new page by passing required information as a navigation
+ // parameter
+ if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
+ {
+ throw new Exception("Failed to create initial page");
+ }
+ }
+ // Ensure the current window is active
+ Window.Current.Activate();
+ }
+
+ /// <summary>
+ /// Invoked when application execution is being suspended. Application state is saved
+ /// without knowing whether the application will be terminated or resumed with the contents
+ /// of memory still intact.
+ /// </summary>
+ /// <param name="sender">The source of the suspend request.</param>
+ /// <param name="e">Details about the suspend request.</param>
+ private void OnSuspending(object sender, SuspendingEventArgs e)
+ {
+ var deferral = e.SuspendingOperation.GetDeferral();
+ //TODO: Save application state and stop any background activity
+ deferral.Complete();
+ }
+ }
+}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,75 @@
+<Page
+ x:Class="hubcontrol_getting_started.MainPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:local="using:hubcontrol_getting_started"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ mc:Ignorable="d">
+
+ <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
+ <SemanticZoom x:Name="Zoom">
+ <SemanticZoom.ZoomedInView>
+ <Hub x:Name="Hub" Header="The Movie App" Background="{StaticResource BackgroundBrush}" SectionHeaderClick="Hub_SectionHeaderClick">
+
+ <HubSection Width="500">
+ <HubSection.Background>
+ <ImageBrush ImageSource="/Assets/poster.jpg" Stretch="UniformToFill"/>
+ </HubSection.Background>
+ </HubSection>
+
+ <HubSection Header="Popular">
+ <DataTemplate>
+ <GridView Loaded="Popular_Loaded" SelectionMode="None" ItemTemplate="{StaticResource Standard250x250ItemTemplate}"/>
+ </DataTemplate>
+ </HubSection>
+
+
+ <HubSection Header="Near You" >
+ <DataTemplate>
+ <GridView Loaded="NearYou_Loaded" SelectionMode="None" ItemTemplate="{StaticResource Standard250x250ItemTemplate}"/>
+ </DataTemplate>
+ </HubSection>
+
+ <HubSection x:Name="TrailersSection" Header="Trailers" Width="550" IsHeaderInteractive="True" >
+ <DataTemplate>
+ <ListView Loaded="MovieTrailers_Loaded"
+ SelectionMode="None"
+ ItemTemplate="{StaticResource Standard130ItemTemplate}"/>
+ </DataTemplate>
+ </HubSection>
+ </Hub>
+ </SemanticZoom.ZoomedInView>
+
+ <SemanticZoom.ZoomedOutView>
+
+ <GridView VerticalAlignment="Center" Margin="200,0,0,0" Loaded="GridView_Loaded">
+ <GridView.ItemTemplate>
+ <DataTemplate>
+ <StackPanel >
+ <TextBlock HorizontalAlignment="Center" Text="{Binding}" Style="{StaticResource SubheaderTextBlockStyle}" />
+ </StackPanel>
+ </DataTemplate>
+ </GridView.ItemTemplate>
+
+ <GridView.ItemContainerStyle>
+ <Style TargetType="GridViewItem">
+ <Setter Property="Margin" Value="4" />
+ <Setter Property="Padding" Value="5" />
+ <Setter Property="HorizontalContentAlignment" Value="Left" />
+ <Setter Property="VerticalContentAlignment" Value="Center" />
+ </Style>
+ </GridView.ItemContainerStyle>
+
+ <GridView.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapGrid ItemWidth="400" ItemHeight="70" Orientation="Horizontal" VerticalChildrenAlignment="Center" MaximumRowsOrColumns="3"></WrapGrid>
+ </ItemsPanelTemplate>
+ </GridView.ItemsPanel>
+ </GridView>
+
+ </SemanticZoom.ZoomedOutView>
+
+ </SemanticZoom>
+ </Grid>
+</Page>
Oops, something went wrong.

0 comments on commit 60daa81

Please sign in to comment.