Skip to content

Instantly share code, notes, and snippets.

Forked from anaisbetts/MainPage.xaml
Created January 1, 2013 08:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanselman/4425999 to your computer and use it in GitHub Desktop.
Save shanselman/4425999 to your computer and use it in GitHub Desktop.
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
To localize the displayed strings copy their values to appropriately named
keys in the app's neutral language resource file (AppResources.resx) then
replace the hard-coded text value between the attributes' quotation marks
with the binding clause whose path points to that string name.
For example:
Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}"
This binding points to the template's string resource named "ApplicationTitle".
Adding supported languages in the Project Properties tab will create a
new resx file per language that can carry the translated values of your
UI strings. The binding in these examples will cause the value of the
attributes to be drawn from the .resx file that matches the
CurrentUICulture of the app at run time.
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
<TextBlock Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<Button x:Name="SaveTime" HorizontalAlignment="Center" Content="Save the Time" />
<Button x:Name="LoadTime" Grid.Row="1" HorizontalAlignment="Center" Content="Load the Time" />
<TextBox x:Name="LoadedTime" Grid.Row="2" IsReadOnly="True" TextWrapping="Wrap"></TextBox>
<!--Uncomment to see an alignment grid to help ensure your controls are
aligned on common boundaries. The image has a top margin of -32px to
account for the System Tray. Set this to 0 (or remove the margin altogether)
if the System Tray is hidden.
Before shipping remove this XAML and the image itself.-->
<!--<Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" />-->
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Akavache;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using AkavacheWP8.Resources;
using ReactiveUI;
namespace AkavacheWP8
public partial class MainPage : PhoneApplicationPage
// Constructor
public MainPage()
BlobCache.ApplicationName = "AkavacheTest";
SaveTime.Click += (o, e) =>
BlobCache.UserAccount.InsertObject("time", new DataModel() {CurrentDate = DateTime.Now, ARandomGuid = Guid.NewGuid().ToString()});
LoadTime.Click += async (o, e) => {
var item = await BlobCache.UserAccount.GetObjectAsync<DataModel>("time");
LoadedTime.Text = String.Format("The date saved was {0} and a random GUID was {1}", item.CurrentDate, item.ARandomGuid);
public class DataModel
public DateTime CurrentDate { get; set; }
public string ARandomGuid { get; set; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment