view MetroWpf/Stocks.UI/StocksView.xaml @ 21:dfc81f8bb838

working version for sttocks except ui within metrowpf
author adminsh@apollo
date Tue, 20 Mar 2012 15:07:31 +0000
parents 6109bc268b90
children
line wrap: on
line source

<UserControl x:Class="Stocks.UI.StocksView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Converters="clr-namespace:Stocks.UI.Converters" 
             mc:Ignorable="d" 
             d:DesignHeight="100" d:DesignWidth="600"
             d:DataContext="{Binding StocksViewModel, Source={StaticResource Locator}}">

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="60" />
            <RowDefinition Height="20" />
            <RowDefinition Height="280" />
            <RowDefinition Height="180" />
        </Grid.RowDefinitions>
        <Grid.Resources>
            <Converters:BoolToServiceRunningTextConverter x:Key="BoolToServiceRunningTextConverter" />
            <Converters:BoolToSubscribedTextConverter x:Key="BoolToSubscribedTextConverter" />
            <Converters:DeltaToIconConverter x:Key="DeltaToIconConverter" />
            <Converters:AbsoluteNumberConverter x:Key="AbsoluteNumberConverter" />
            <!--<Converters:DateTimeToTimeConverter x:Key="DateTimeToTimeConverter" />-->
        </Grid.Resources>

        <StackPanel Grid.Row="0" Orientation="Horizontal">
            <Button x:Name="btnServiceRunning"
              Width="100"
              Height="30"
              HorizontalAlignment="Left" 
              Content="{Binding Path=ServiceRunning, Converter={StaticResource BoolToServiceRunningTextConverter}}" 
              Command="{Binding Path=ServiceCommand, Mode=TwoWay}"
              Margin="5,0,0,0"/>
            <Button x:Name="btnSubscribe"
              Width="100"
              Height="30"
              Margin="10,0,0,0"
              HorizontalAlignment="Left" 
              Content="{Binding Path=Subscribed, Converter={StaticResource BoolToSubscribedTextConverter}}" 
              Command="{Binding Path=SubscriptionCommand, Mode=TwoWay}" />
        </StackPanel>

        <StackPanel Grid.Row="1" Orientation="Horizontal">
            <TextBlock Text="Company" Width="170" Margin="5,0,0,0" />
            <TextBlock Text="Price" Width="100" />
            <TextBlock Text="Previous" Width="100" />
            <TextBlock Text="Change" Width="105" />
            <TextBlock Text="Time" Width="105" />
        </StackPanel>
        <ListBox x:Name="lbStockPrices" 
             ItemsSource="{Binding Path=DisplayStockPrices}" 
             BorderThickness="0" FontFamily="Segoe UI"
             Grid.Row="2">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" Height="25">
                        <TextBlock Text="{Binding CompanyName}" Width="125" FontSize="15" Margin="10,0,0,0"/>
                        <TextBlock Text="{Binding Symbol}" Width="45" FontSize="15" Margin="10,0,0,0"/>
                        <TextBlock Text="{Binding CurrentPrice}" Width="100" FontSize="15" />
                        <TextBlock Text="{Binding PreviousPrice}" Width="100" FontSize="15" />
                        <Image Source="{Binding Delta, Converter={StaticResource DeltaToIconConverter}}" Width="20" />
                        <TextBlock Text="{Binding Delta, Converter={StaticResource AbsoluteNumberConverter}}" Width="85" FontSize="15" />
                        <!--<TextBlock Text="{Binding Timestamp, Converter={StaticResource DateTimeToTimeConverter}}" Width="100" FontSize="15" />-->
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
    </UserControl>