SPARK-687 Create Synthetic dialog does not update Name field if 'Enter' is pressed...

This commit is contained in:
John Colvin committed 2018-03-20 14:57:53 -04:00
1 parent 4caaa36d26
commit bb93cf4944
2 files changed
+12 -2

No files matched your search

@@ -350,7 +350,15 @@
<TextBox
x:Name="PART_Name_TextBox" Grid.Column="1" Margin="6,0,0,0" HorizontalAlignment="Stretch" IsEnabled="{TemplateBinding IsNew}"
Text="{Binding SyntheticName, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}, ValidatesOnDataErrors=True, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True}"
/>
>
<u:Behavior.BindingUpdateGroups>
<u:BindingUpdateGroupCollection>
<u:BindingUpdateGroup Source="{Binding DataContext, Source={u:DirectReference PART_Name_TextBox}}" Target="{Binding Source={u:DirectReference PART_Name_TextBox}}">
<u:PropertyTuple PropertyName="Text" Type="{x:Type TextBox}"/>
</u:BindingUpdateGroup>
</u:BindingUpdateGroupCollection>
</u:Behavior.BindingUpdateGroups>
</TextBox>
<TextBlock
Grid.Column="2" VerticalAlignment="Center" Margin="6,0,0,0" Text="Ticks" IsEnabled="{TemplateBinding IsNew}"
Visibility="{Binding LegTuples.Count, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource IntNotZeroVisibilityConverter}}"
@@ -20,7 +20,7 @@ namespace mbts.spark {
/// <summary>
/// The view model designed to serve as the DataContext for the SyntheticEditorView
/// </summary>
partial class SyntheticEditorVM : ViewModelBaseWithValidation, IRequestViewClose, IDisposable {
partial class SyntheticEditorVM : ViewModelBaseWithValidation, IRequestViewClose, IRequestBindingSourceUpdate, IDisposable {
readonly ObservableCollection<TickFactors> _available_tick_factors = new ObservableCollection<TickFactors>(TickUtils.all_present_ticks());
readonly QuantityModel _quantity_model;
readonly PriceMultiplierModel _price_mult_model;
@@ -73,6 +73,7 @@ namespace mbts.spark {
};
remove_leg = new DelegateCommand<Security>(s => leg_tuples.removeFirst(l => l.leg.Security.Id == s.Id));
commit = new DelegateCommand(async () => {
RequestUpdate?.Invoke();
bool valid = true;
if (string.IsNullOrWhiteSpace(name)) {
flash_error_msg("Please enter a name", SparkUtils.UI.MessageFlashDuration, nameof(name)).ignore();
@@ -189,6 +190,7 @@ namespace mbts.spark {
}
public event EventHandler RequestClose;
public event Action RequestUpdate;
public string title { get; }
public ImageSource icon { get; }