From 3fe0306864e8f996ac654f86fcec4bbb4bb435cb Mon Sep 17 00:00:00 2001 From: John Colvin Date: Fri, 5 Apr 2019 13:55:57 -0500 Subject: [PATCH] AlgoEditorGridView - added IsReadOnly dp, and corresponding VisualState --- .../AlgoEditorGridView.xaml | 24 ++++++++++++++++++- .../AlgoEditorGridView.xaml.cs | 19 +++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/client/spark/Modules/Trading/AlgoStudio/View/AlgoEditorGridView/AlgoEditorGridView.xaml b/src/client/spark/Modules/Trading/AlgoStudio/View/AlgoEditorGridView/AlgoEditorGridView.xaml index 773056402..5e6c082a9 100644 --- a/src/client/spark/Modules/Trading/AlgoStudio/View/AlgoEditorGridView/AlgoEditorGridView.xaml +++ b/src/client/spark/Modules/Trading/AlgoStudio/View/AlgoEditorGridView/AlgoEditorGridView.xaml @@ -1,4 +1,5 @@  @@ -253,7 +253,28 @@ + + + + + + + + + + + + + + + + + + + + + @@ -292,6 +313,7 @@ x:Name="_param_grid" Grid.Row="1" VirtualizingPanel.ScrollUnit="Pixel" + IsReadOnly="False" Margin="0,2,0,0" MinRowHeight="18" ColumnHeaderHeight="0" diff --git a/src/client/spark/Modules/Trading/AlgoStudio/View/AlgoEditorGridView/AlgoEditorGridView.xaml.cs b/src/client/spark/Modules/Trading/AlgoStudio/View/AlgoEditorGridView/AlgoEditorGridView.xaml.cs index b188c8db9..50b736b60 100644 --- a/src/client/spark/Modules/Trading/AlgoStudio/View/AlgoEditorGridView/AlgoEditorGridView.xaml.cs +++ b/src/client/spark/Modules/Trading/AlgoStudio/View/AlgoEditorGridView/AlgoEditorGridView.xaml.cs @@ -11,6 +11,7 @@ using System.Windows.Documents; namespace mbts.ui.spark { partial class AlgoEditorGridView : UserControl { public static readonly IValueConverter + GeneralVisualStateConverter = ValueConverter.create(is_read_only => is_read_only ? VisualStateNames.General.ReadOnly : VisualStateNames.General.Normal), AlgoRootVisualStateConverter = ValueConverter.create(show_bbo => show_bbo ? VisualStateNames.AlgoRoot.Active : VisualStateNames.AlgoRoot.Inactive), AlgoRootComboBoxMarginConverter = ValueConverter.create(name_col_width => new Thickness(name_col_width + 8, 0, 0, 0)); @@ -28,6 +29,16 @@ namespace mbts.ui.spark { public CollectionViewSource> ParamRowsViewSource { get; } + #region IsReadOnly + public static readonly DependencyProperty IsReadOnlyProperty = + WPFHelper.create_dp(nameof(IsReadOnly)); + + public bool IsReadOnly { + get => (bool)GetValue(IsReadOnlyProperty); + set => SetValue(IsReadOnlyProperty, value); + } + #endregion + #region CanUserChangeAlgoRoot public static readonly DependencyProperty CanUserChangeAlgoRootProperty = WPFHelper.create_dp(nameof(CanUserChangeAlgoRoot)); @@ -79,6 +90,14 @@ namespace mbts.ui.spark { } public static class VisualStateNames { + public static class General { + public const string GroupName = nameof(General); + + public static readonly string + Normal = $"{GroupName}{nameof(Normal)}", + ReadOnly = $"{GroupName}{nameof(ReadOnly)}"; + } + public static class AlgoRoot { public const string GroupName = nameof(AlgoRoot);