comparison 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
comparison
equal deleted inserted replaced
22:a7a4cde39999 23:399398841fd0
1 <UserControl x:Class="Stocks.UI.Views.StocksView"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:Converters="clr-namespace:Stocks.UI.Converters"
5 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7 d:DesignHeight="100"
8 d:DesignWidth="600"
9 DataContext="d:DesignInstance vm:StocksViewModel"
10 mc:Ignorable="d">
11
12 <Grid x:Name="LayoutRoot">
13 <Grid.RowDefinitions>
14 <RowDefinition Height="60" />
15 <RowDefinition Height="20" />
16 <RowDefinition Height="400" />
17 <RowDefinition Height="180" />
18 </Grid.RowDefinitions>
19 <Grid.Resources>
20 <Converters:BoolToServiceRunningTextConverter x:Key="BoolToServiceRunningTextConverter" />
21 <Converters:BoolToSubscribedTextConverter x:Key="BoolToSubscribedTextConverter" />
22 <Converters:DeltaToIconConverter x:Key="DeltaToIconConverter" />
23 <Converters:AbsoluteNumberConverter x:Key="AbsoluteNumberConverter" />
24 <Converters:DateTimeToTimeConverter x:Key="DateTimeToTimeConverter" />
25 </Grid.Resources>
26
27 <StackPanel Grid.Row="0" Orientation="Horizontal">
28 <Button x:Name="btnServiceRunning"
29 Width="100"
30 Height="30"
31 Margin="5,0,0,0"
32 HorizontalAlignment="Left"
33 Command="{Binding ServiceCommand,
34 Mode=TwoWay}"
35 Content="{Binding ServiceRunning,
36 Converter={StaticResource BoolToServiceRunningTextConverter}}" />
37 <Button x:Name="btnSubscribe"
38 Width="100"
39 Height="30"
40 Margin="10,0,0,0"
41 HorizontalAlignment="Left"
42 Command="{Binding SubscriptionCommand,
43 Mode=TwoWay}"
44 Content="{Binding Subscribed,
45 Converter={StaticResource BoolToSubscribedTextConverter}}" />
46 </StackPanel>
47
48 <StackPanel Grid.Row="1" Orientation="Horizontal">
49 <TextBlock Width="260"
50 Margin="5,0,0,0"
51 Text="Company" />
52 <TextBlock Width="80" Text="Symbol" />
53 <TextBlock Width="100" Text="Price" />
54 <TextBlock Width="100" Text="Previous" />
55 <TextBlock Width="105" Text="Change" />
56 </StackPanel>
57 <ListBox x:Name="lbStockPrices"
58 Grid.Row="2"
59 BorderThickness="0"
60 FontFamily="Segoe UI"
61 ItemsSource="{Binding Path=DisplayStockPrices}">
62 <ListBox.ItemTemplate>
63 <DataTemplate>
64 <StackPanel Orientation="Horizontal">
65 <TextBlock Width="263"
66 Margin="2,0,0,0"
67 FontSize="15"
68 Text="{Binding CompanyName}" />
69 <TextBlock Width="80"
70 FontSize="15"
71 Text="{Binding Symbol}" />
72 <TextBlock Width="100"
73 FontSize="15"
74 Text="{Binding CurrentPrice}" />
75 <TextBlock Width="100"
76 FontSize="15"
77 Text="{Binding PreviousPrice}" />
78 <Image Width="20" Source="{Binding Delta, Converter={StaticResource DeltaToIconConverter}}" />
79 <TextBlock Width="85"
80 FontSize="15"
81 Text="{Binding Delta,
82 Converter={StaticResource AbsoluteNumberConverter}}" />
83 <!--
84 <TextBlock Width="85"
85 FontSize="15"
86 Text="{Binding Timestamp,
87 Converter={StaticResource DateTimeToTimeConverter}}" />
88 -->
89 </StackPanel>
90 </DataTemplate>
91 </ListBox.ItemTemplate>
92 </ListBox>
93 </Grid>
94 </UserControl>