Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
118 lines (106 sloc) 5.38 KB
<UserControl
x:Class="Trader.Client.Views.PositionsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:infrastucture="clr-namespace:Trader.Client.Infrastucture"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:model="clr-namespace:Trader.Domain.Model;assembly=Trader.Domain"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:views="clr-namespace:Trader.Client.Views"
d:DataContext="{d:DesignInstance views:PositionsViewer,
IsDesignTimeCreatable=False}"
d:DesignHeight="300"
d:DesignWidth="300"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ListBox.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml" />
</ResourceDictionary.MergedDictionaries>
<DataTemplate DataType="{x:Type model:CurrencyPairPosition}">
<Grid Width="235" DataContext="{Binding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Background="{DynamicResource PrimaryHueLightBrush}" TextBlock.Foreground="{DynamicResource PrimaryHueLightForegroundBrush}">
<StackPanel Orientation="Vertical">
<TextBlock
Margin="4,0,4,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
Text="{Binding CurrencyPair}" />
<TextBlock
Margin="4,0,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Text="{Binding Position.CountText}" />
</StackPanel>
</Border>
<Grid
Grid.Column="1"
Margin="4"
HorizontalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="Buy" />
<TextBlock
Grid.Row="0"
Grid.Column="1"
HorizontalAlignment="Right"
Text="{Binding Position.Buy, StringFormat='#,##00'}" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Text="Sell" />
<TextBlock
Grid.Row="1"
Grid.Column="1"
Margin="0,0,0,5"
HorizontalAlignment="Right"
Text="{Binding Position.Sell, StringFormat='#,##00'}" />
<TextBlock
Grid.Row="2"
Grid.Column="1"
HorizontalAlignment="Right"
FontSize="14"
Text="{Binding Position.Position, StringFormat='#,##00'}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<DataTrigger Binding="{Binding Position.Negative}">
<DataTrigger.Value>
<system:Boolean>True</system:Boolean>
</DataTrigger.Value>
<Setter Property="Foreground" Value="Red" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</Grid>
</DataTemplate>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<ListBox ItemsSource="{Binding Data}" Style="{StaticResource MaterialDesignCardsListBox}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<infrastucture:AnimatedWrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ListBox>
</Grid>
</UserControl>