Files
spark/src/client/spark/Modules/Trading/Ladder/View/LadderSettingsView.xaml.cs
T

40 lines
1.9 KiB
C#

using mbts.ui.converters;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
namespace mbts.ui.spark {
/// <summary>
/// Interaction logic for LadderSettingsView.xaml
/// </summary>
partial class LadderSettingsView : UserControl {
public const string
OrdersColumnTemplateKey = nameof(OrdersColumnTemplateKey),
VolumeColumnTemplateKey = nameof(VolumeColumnTemplateKey),
LastColumnTemplateKey = nameof(LastColumnTemplateKey),
FavoriteAlgoAddButtonTemplateKey = nameof(FavoriteAlgoAddButtonTemplateKey);
public static readonly IMultiValueConverter LadderColumnToggleShowToolTipConverter =
ValueConverter.create<bool, bool, string, string>((can_toggle_show, show, col_name) =>
can_toggle_show ? $"{(show ? "Hide" : "Show")} {col_name}" : $"{col_name} cannot be {(show ? "hidden" : "shown")}.");
public LadderSettingsView() =>
InitializeComponent();
public static IMultiValueConverter MktBreakLineBrushConverter =
ValueConverter.create<Color, bool, Brush>((color, show) => show ? new SolidColorBrush(color) : Brushes.Transparent);
public static IMultiValueConverter VolumeBarWidthConverter =>
ValueConverter.create<uint, uint, double, double>((value, max, container_width) => container_width * (double)value / (double)max);
public static readonly DependencyProperty VolumeComponentValueProperty =
DependencyProperty.RegisterAttached("VolumeComponentValue",
typeof(uint),
typeof(LadderSettingsView),
new PropertyMetadata(0u));
public static uint GetVolumeComponentValue(DependencyObject d) => (uint)d.GetValue(VolumeComponentValueProperty);
public static void SetVolumeComponentValue(DependencyObject d, uint value) => d.SetValue(VolumeComponentValueProperty, value);
}
}