view MetroWpf/Stocks.UI/Views/StocksView.xaml @ 24:a8b50a087544

Stocks and FxRates working, new menu introduced. Working nicely so far
author adminsh@apollo
date Tue, 20 Mar 2012 20:18:35 +0000
parents 399398841fd0
children 4b8b38d17d24
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"
             d:DesignHeight="100"
             d:DesignWidth="600"
             DataContext="d:DesignInstance vm: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 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 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>