view MetroWpf/Stocks.UI/Views/StocksView.xaml @ 90:d523381be45a

nuge restore added
author stevenhollidge <stevenhollidge@hotmail.com>
date Mon, 30 Apr 2012 10:48:49 +0100
parents 4b8b38d17d24
children
line wrap: on
line source

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

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="60" />
            <RowDefinition Height="20" />
            <RowDefinition Height="400" />
            <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"
                    Margin="5,0,0,0"
                    HorizontalAlignment="Left"
                    Command="{Binding Path=ServiceCommand,
                                      Mode=TwoWay}"
                    Content="{Binding ServiceRunning,
                                      Converter={StaticResource BoolToServiceRunningTextConverter}}" />
            <Button x:Name="btnSubscribe"
                    Width="100"
                    Height="30"
                    Margin="10,0,0,0"
                    HorizontalAlignment="Left"
                    Command="{Binding Path=SubscriptionCommand,
                                      Mode=TwoWay}"
                    Content="{Binding Subscribed,
                                      Converter={StaticResource BoolToSubscribedTextConverter}}" />
        </StackPanel>

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