C#

Save objects to the ‘LocalFolder’

IMPORTANT: You find the newest versions of TCD.Serialization on NuGet – it works with Windows Phone as well. This post will Show you how to serialize and save objects with XML to your apps LocalFolder/RoamingFolder. Metro style apps in Windows 8 have their own folders where they can store their data. These folders can be accessed by: StorageFolder localFolder = ApplicationData.Current.LocalFolder; StorageFolder roamingFolder = ApplicationData.Current.RoamingFolder; The difference between these two folders is that Windows 8 will synchronise the RoamingFolder between different machines. This can be useful if you want to improve the user experience, for example by synchronising drafts of a blog post between a users tablet and PC. It’s very important, that the data you want to save is serializable. When designing the data structure and classes for your data, you got to make sure, that each class has a parameterless constructor. Properties can be marked with a set…

Metro

Column-Styled GridView

Today I had to figure out a way to make a single-row, column-styled GridView that looked like this: Some minor design improvements are still to be made, but the hardest part is done. Particulary tricky was, that the items didn’t want to Stretch the height. (I wanted to avoid hard-coding the height, because of different screen resolutions.) Finally I’m using a GridView – I archived almost the same results with a ListView, but the ScrollBar was gone.. Maybe this is possible with a ListBox as well, but maybe I want to integrate this with a SemanticZoom control later, which requires ListView or GridView. Here’s a screenshot of the XAML code: You can copy/paste the following: <GridView ItemsSource=”{Binding Mensen}” SelectionChanged=”GridView_SelectionChanged”>                 <GridView.ItemTemplate>                     <DataTemplate>                         <Grid Background=”Green” Width=”250″>                             <Grid.RowDefinitions>                                 <RowDefinition Height=”Auto” />                                 <RowDefinition Height=”*” />                             </Grid.RowDefinitions>                             <TextBlock Grid.Row=”0″ Text=”{Binding Titel}” Foreground=”{StaticResource ListViewItemOverlayForegroundThemeBrush}” Style=”{StaticResource TitleTextStyle}” Height=”60″ Margin=”15,0,15,0″…

C#

Migrating TCD to Windows 8 Release Preview

Two days ago, I migrated my laptop to Windows 8 Release Preview and today Windows Live Mesh finished syncing all of my files. So in the last few hours I migrated all the dev stuff and I’d like to share the latest versions of them too. Most of the libraries haven’t changed that much, only their namespaces have changed from TCD.Windows8.xxxx to TCD.xxxx. TCD.Serialization TCD.Serialization.Xml.XmlDeSerializer – (de)serialize an object from/to a string or Stream using XML TCD.Serialization.Json.JsonDeSerializer – (de)serialize an object from/to a string or Stream using JSON Download TCD.Serialization.zip TCD.Controls TCD.Controls.Flyout – create your own Flyout TCD.Controls.Settings.SettingsContractWrapper – integrate with the settings contract in just a few lines of code Download FlyoutAndSettingsSample.zip