Thursday, January 31, 2013

SL with MVVM xaml

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vm="clr-namespace:MyNamespage.ViewModel"
    xmlns:cod="clr-namespace:MyNamespage.Tools"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    x:Class="MyNamespage.MainPage"
    mc:Ignorable="d" DataContext="{Binding  Main, Source={StaticResource Locator}}"
    d:DesignHeight="600" d:DesignWidth="800">

    <UserControl.Resources>
        <cod:AIImageBuilder x:Name="ImageBuilder"/>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">

        <sdk:Label HorizontalAlignment="Left" Height="23" Margin="22,22,0,0" VerticalAlignment="Top" Width="120"/>
        <TextBox Text="{Binding Main.HomeModel.TopTitle, Source={StaticResource Locator}}"
                 HorizontalAlignment="Left" Height="23" Margin="147,22,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="402"/>
        <Image Source="{Binding HomeModel.TopImageUrl, Converter={StaticResource ImageBuilder}}"
               HorizontalAlignment="Left" Height="100" Margin="147,50,0,0" VerticalAlignment="Top" Width="100"/>

    </Grid>
</UserControl>

No comments: