Files
spark/src/client/spark/view/Controls/TickUpDown/PriceEntryCommitControl.xaml
T
John Colvin 066a0ba693 ui: Use dark theme foreground in mini orderbook, fills popups
It was black in a couple places before, making it hard to read.
2025-03-10 14:47:58 -04:00

86 lines
4.4 KiB
XML

<UserControl x:Class="mbts.ui.controls.PriceEntryCommitControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
xmlns:u="clr-namespace:mbts.ui"
xmlns:cv="clr-namespace:mbts.ui.converters"
xmlns:c="clr-namespace:mbts.ui.controls"
xmlns:usp="clr-namespace:mbts.ui.spark"
d:DesignHeight="100" d:DesignWidth="800" x:Name="_me_price"
Foreground="{u:BTSColor UI.input_text}">
<UserControl.Resources>
<cv:NullableDoubleConverter x:Key="TickDefaultPriceConverter" DefaultValue="0"/>
<cv:TickDisplayConverter x:Key="TickDisplayConverter" x:Shared="False"/>
<ControlTemplate x:Key="ReadTemplate">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock.Text>
<MultiBinding Converter="{StaticResource TickDisplayConverter}">
<Binding Path="SourceValue" ElementName="_me_price"/>
<Binding Path="SourceContractSpec" ElementName="_me_price"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</Grid>
</ControlTemplate>
<ControlTemplate x:Key="EditTemplate">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!--
<Button x:Name="commit_button" CommandParameter="{Binding Value, ElementName=price_ticker}" Command="{Binding OnCommit, ElementName=_me_price}" Content="✔" >
<Button.Style>
<Style TargetType="Button">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="True">
<Setter Property="Background" Value="Green" />
<Setter Property="Foreground" Value="White" />
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
-->
<!-- we need this Converter here on Value b/c Value and TickDefaultValue are both being bound to SourceValue, -->
<!-- whereas in the OrderModificationControl Value and TickDefaultValue are both to different properties. I -->
<!-- believe this is why we initially observed the edit template sometimes tick-rounding to an incorrect -->
<!-- value; i.e. 14.895 was tick-rounded to 14.89 -->
<usp:PriceEntryControl x:Name="price_ticker"
TickDefaultValue="{Binding SourceValue, ElementName=_me_price, Converter={StaticResource TickDefaultPriceConverter}, FallbackValue={u:Double 0}}"
ContractSpec="{Binding SourceContractSpec, ElementName=_me_price}"
Value="{Binding SourceValue, ElementName=_me_price, Converter={StaticResource TickDefaultPriceConverter}}"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Style="{StaticResource PriceEntryControlWithoutButtons}"
IsTabStop="False"
/>
</Grid>
</ControlTemplate>
</UserControl.Resources>
<UserControl.Style>
<Style TargetType="UserControl">
<Setter Property="Template" Value="{StaticResource ReadTemplate}"/>
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding is_selected}" Value="True" />
<Condition Binding="{Binding is_non_terminal}" Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Template" Value="{StaticResource EditTemplate}"/>
</MultiDataTrigger>
<DataTrigger Binding="{Binding is_price_dirty}" Value="True">
<Setter Property="Template" Value="{StaticResource EditTemplate}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</UserControl.Style>
</UserControl>