diff MetroWpf/Stocks.UI/Views/StocksView.xaml @ 23:399398841fd0

Working version for Stocks (including loosely coupled components
author adminsh@apollo
date Tue, 20 Mar 2012 16:53:29 +0000
parents
children 4b8b38d17d24
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MetroWpf/Stocks.UI/Views/StocksView.xaml	Tue Mar 20 16:53:29 2012 +0000
@@ -0,0 +1,94 @@
+<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>
\ No newline at end of file