Archive for January, 2013

Good news to all developers working on windows 8 applications!!

There are 50 “Store Ready” templates for Windows 8 in the form of Visual Studio projects. Templates are a great way to get started. Developers can now choose a design template which is closest to their design/implementation, customize and give life to their idea. The templates have been created keeping in mind the Windows 8 style & experience. Just by binding the relevant data, developers should have a good looking app that runs in the paradigm of Windows 8.

clip_image001
Fashion
clip_image002
Finance
clip_image003
Fitness
clip_image007
Product
clip_image008
Life Style
clip_image009
Health & Fitness
 clip_image013
Jewellery
clip_image014
Baby Journal
clip_image015
Music
clip_image019
Electronics
clip_image020
Notes
clip_image021
Photo Browser
clip_image024
Shoes
clip_image001
Food Light
 clip_image001[1]
Food Variable Tile
clip_image025
Block Styled Colour
clip_image026
Blocks
clip_image027
Bricks Style
clip_image031
Translator
clip_image032
Tutor
clip_image033
Invitation
clip_image037
Planning Diary
clip_image038
Shopping
clip_image039
Solution
clip_image043
News Grey
clip_image044
Basic Game
clip_image045
Pillar Block
clip_image046
Recipe
clip_image047
Restaurant
clip_image048
News Dark
clip_image049
Block Style Pic
clip_image050
Tutor Advanced

Having implemented Meteo and Zougla apps for windows 8 using MVVM Light I found that handling events wasn’t so straight forward.

While there are controls, like the Button control, that expose the Command and CommandParameter properties and can be bound to ICommand, (RelayCommand if you’re using MVVM light) typed properties in the ViewModel but there are many more that do not. What’s more a control may expose many events but have only one ICommand typed property for the most common interaction. Now in Silverlight, this can be easily fixed using the EventToCommand class that bridges the gap between events and commands. However, that doesn’t work in Windows 8.

Luckily though there is a replacement projects you could use to bind events to command properties in your ViewModels.

WinRtBehaviors

This project tries to fill the gap for people who really need behaviors to get cracking in XAML for Windows 8 apps and is also available as a NuGet package so can easily integrate it in your apps. The way you use it to trigger execution of the command when the user raises an event is pretty easy too:

<ListBox ItemsSource="{Binding ToDoItems}" Height="300" Name="MyListBox" 

            SelectedItem="{Binding SelectedToDo, Mode=TwoWay}" >

    <WinRtBehaviors:Interaction.Behaviors>

        <Win8nl_Behavior:EventToCommandBehavior Event="SelectionChanged" 

                                                Command="ItemClickCommand" 

                                                CommandParameter="{Binding SelectedToDo, Mode=TwoWay}"/>

    </WinRtBehaviors:Interaction.Behaviors>

    <ListBox.ItemTemplate>

        <DataTemplate>

            <TextBlock Text="{Binding Title}"></TextBlock>

        </DataTemplate>

    </ListBox.ItemTemplate>

</ListBox>

Notice that you can also use the CommandParameter property to pass data – again using a binding to pass data to your ViewModel.

Hope this helps.