ui: Refine vs exp header col style

This commit is contained in:
John Colvin committed 2022-02-14 14:01:51 -05:00
1 parent e3b6c9829a
commit 4cf8959b13
3 files changed
+36 -6

No files matched your search

@@ -184,6 +184,25 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ExpirationFilterDropDown" TargetType="c:ComboCheckBox" BasedOn="{StaticResource {x:Type c:ComboCheckBox}}">
<Setter Property="HeaderContent" Value="Expirations"/>
<Setter Property="HeaderContentTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding}" VerticalAlignment="Center" />
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="c:ComboCheckBoxItem">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
</Style>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<AdornerDecorator>
@@ -1,4 +1,5 @@
namespace mbts.spark.VolSurface {
using mbts.ui;
using mbts.ui.controls;
using mbts.ui.converters;
@@ -39,6 +40,7 @@ namespace mbts.spark.VolSurface {
}
static Thickness _cell_padding => new(4, 0, 4, 0);
static Thickness _header_cell_padding => new(6, 0, 4, 0);
IValueConverter _data_context_converter =>
ValueConverter.create<VolSurfaceRowContext, object>(row => row?.get_cell(model));
@@ -52,11 +54,19 @@ namespace mbts.spark.VolSurface {
};
FrameworkElement row_header_cell() {
var view = new TextBlock {
FontWeight = FontWeights.Bold,
var text = new TextBlock {
HorizontalAlignment = HorizontalAlignment.Left,
Foreground = BTSColors.header_text.to_brush(),
};
view.SetBinding(TextBlock.TextProperty, new Binding(nameof(VolSurfaceRowContext.expiration)));
return view;
text.SetBinding(TextBlock.TextProperty, new Binding(nameof(VolSurfaceRowContext.expiration)));
var bd = new Border {
HorizontalAlignment = HorizontalAlignment.Stretch,
Padding = _header_cell_padding,
Background = BTSColors.header.to_brush(),
BorderThickness = new(0),
Child = text
};
return bd;
}
FrameworkElement read_only_cell() {
@@ -16,6 +16,7 @@
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
@@ -72,8 +73,8 @@
_columns_model);
VolSurfaceColumn create_exp_column_view() {
var filter = new ComboCheckBox { HeaderContent = "Expirations" };
filter.Foreground = Brushes.Black;
var filter = new ComboCheckBox();
filter.SetResourceReference(FrameworkElement.StyleProperty, "ExpirationFilterDropDown");
filter.SetBinding(ItemsControl.ItemsSourceProperty, new Binding(nameof(rows)) {
Source = this,
Mode = BindingMode.OneWay