diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
index f52502575..5abaccfd3 100644
--- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
+++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
@@ -34,6 +34,7 @@
+
diff --git a/src/Artemis.UI.Shared/Behaviors/PutCursorAtEndTextBoxBehavior.cs b/src/Artemis.UI.Shared/Behaviors/PutCursorAtEndTextBoxBehavior.cs
new file mode 100644
index 000000000..b564ccb87
--- /dev/null
+++ b/src/Artemis.UI.Shared/Behaviors/PutCursorAtEndTextBoxBehavior.cs
@@ -0,0 +1,34 @@
+using System.Windows;
+using System.Windows.Controls;
+using Microsoft.Xaml.Behaviors;
+
+namespace Artemis.UI.Shared.Behaviors
+{
+ public class PutCursorAtEndTextBoxBehavior : Behavior
+ {
+ private TextBox _textBox;
+
+ protected override void OnAttached()
+ {
+ base.OnAttached();
+
+ _textBox = AssociatedObject as TextBox;
+
+ if (_textBox == null) return;
+ _textBox.GotFocus += TextBoxGotFocus;
+ }
+
+ protected override void OnDetaching()
+ {
+ if (_textBox == null) return;
+ _textBox.GotFocus -= TextBoxGotFocus;
+
+ base.OnDetaching();
+ }
+
+ private void TextBoxGotFocus(object sender, RoutedEventArgs routedEventArgs)
+ {
+ _textBox.CaretIndex = _textBox.Text.Length;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs
index aaf767c55..100ed4e52 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs
@@ -1,4 +1,6 @@
-using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
+using System;
+using System.Windows;
+using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
using Stylet;
namespace Artemis.UI.Shared.DataModelVisualization
@@ -22,20 +24,66 @@ namespace Artemis.UI.Shared.DataModelVisualization
public DataModelPropertyAttribute Description { get; }
internal override object InternalGuard { get; } = null;
- protected void Submit()
+ ///
+ public sealed override void Submit()
{
+ OnSubmit();
+ UpdateCallback(InputValue, true);
+ }
+
+ ///
+ public sealed override void Cancel()
+ {
+ OnCancel();
+ UpdateCallback(InputValue, false);
}
}
///
/// For internal use only, implement instead.
///
- public abstract class DataModelInputViewModel : PropertyChangedBase
+ public abstract class DataModelInputViewModel : PropertyChangedBase, IViewAware
{
///
/// Prevents this type being implemented directly, implement instead.
///
// ReSharper disable once UnusedMember.Global
internal abstract object InternalGuard { get; }
+
+ internal Action