Happy stress free coding

Sep 7, 2009

All you need to run WPF and ECO

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using Eco.Handles;
using Eco.WPF;
using Eco.ViewModel.Runtime;

namespace wpf1
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        EcoSpace _ecoSpace;
        public Window1()
        {
            InitializeComponent();
            _ecoSpace=new EcoProject1.EcoProject1EcoSpace();
            _ecoSpace.Active=true;
            WPFDequeuer.Active = true;
            ViewDefinitionsInApplication.Init(_ecoSpace);
        }
    }
}

and the xaml

<Window x:Class="wpf1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:c="clr-namespace:Eco.ViewModel.WPF;assembly=Eco.WPF"
    xmlns:d="clr-namespace:EcoProject1;assembly=EcoProject1.EcoSpace"
    Title="Window1" Height="458" Width="786"
        >
    <Window.Resources>
        <Style x:Key="MyStyle" TargetType="TextBlock">
            <Setter Property="Background" Value="Pink"></Setter>
        </Style>

    </Window.Resources>
    <Grid ShowGridLines="True">
        <Grid.ColumnDefinitions>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>

        <StackPanel>
            <TextBlock Grid.Column="1" Grid.Row="1" Text="Hello World">
            <TextBlock.Style>
                <Style TargetType="TextBlock">
                    <Setter Property="Background" Value="Green"></Setter>
                </Style>
            </TextBlock.Style>
            </TextBlock>

        </StackPanel>
        <TextBlock  Text="Hello World 2" Style="{StaticResource MyStyle}" Height="20" VerticalAlignment="Bottom">
            <Grid.Column>1</Grid.Column>
            <Grid.Row>0</Grid.Row>
        </TextBlock>

        <c:ViewModelWPFUserControl Grid.Column="0" Grid.Row="1" x:Name="MyViewModel" EcoSpaceTypeName="EcoProject1.EcoProject1EcoSpace" ViewModelName="Forest"></c:ViewModelWPFUserControl>

    </Grid>
</Window>

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home