Make new ladder grid use 1 row per tick with fixed row count

This commit is contained in:
John Colvin committed 2026-08-14 14:42:12 -04:00
1 parent b39ea9528c
commit 1ef2ed9d57
2 files changed
+15 -20

No files matched your search

@@ -256,26 +256,20 @@ class NewOrderTicketLadderVM : DisposableViewModelBase, IOrderModificationLadder
class OrderTicketLadderPriceLevelVM : ViewModelBase {
Color background = Colors.Transparent;
Color priceForeground = BTSColors.Control.normal_foreground;
Color quantityForeground = BTSColors.Control.normal_foreground;
Side side;
double price = double.NaN;
double quantity = double.NaN;
public OrderTicketLadderPriceLevelVM(Side side) {
Side = side;
this.side = side;
background = BTSColors.Ladder.price_column_background;
priceForeground = BTSColors.Ladder.price_column_foreground;
switch (side) {
case Side.Buy:
quantityForeground = BTSColors.Ladder.bid_column_foreground;
break;
case Side.Sell:
quantityForeground = BTSColors.Ladder.ask_column_foreground;
break;
}
}
public Side Side { get; }
public Side Side {
get => side;
set => Set(ref side, value, dependent_props: nameof(QuantityForeground));
}
public double Price {
get => price;
set => Set(ref price, value);
@@ -293,8 +287,10 @@ class OrderTicketLadderPriceLevelVM : ViewModelBase {
get => priceForeground;
set => Set(ref priceForeground, value);
}
public Color QuantityForeground {
get => quantityForeground;
set => Set(ref quantityForeground, value);
}
public Color QuantityForeground =>
side switch {
Side.Buy => BTSColors.Ladder.bid_column_foreground,
Side.Sell => BTSColors.Ladder.ask_column_foreground,
_ => BTSColors.UI.default_foreground,
};
}
@@ -258,8 +258,6 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="{Binding Source={StaticResource VerticalSpacing}}" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid
Grid.Row="0"
@@ -276,8 +274,9 @@
<TextBlock Grid.Column="1" HorizontalAlignment="Center" Text="Price" />
<TextBlock Grid.Column="2" HorizontalAlignment="Center" Text="Ask" />
</Grid>
<ItemsControl Grid.Row="1" ItemsSource="{Binding Asks}" ItemTemplate="{StaticResource PriceLevelItemTemplate}" />
<ItemsControl Grid.Row="3" ItemsSource="{Binding Bids}" ItemTemplate="{StaticResource PriceLevelItemTemplate}" />
<ScrollViewer Grid.Row="1" x:Name="priceLevelsScrollViewer" MaxHeight="240">
<ItemsControl ItemsSource="{Binding PriceLevels}" ItemTemplate="{StaticResource PriceLevelItemTemplate}" />
</ScrollViewer>
</Grid>
<!-- Order Inputs -->