diff --git a/src/Ursa.Themes.Semi/Controls/ControlClassesInput.axaml b/src/Ursa.Themes.Semi/Controls/ControlClassesInput.axaml
index b616c6e..b0a65a1 100644
--- a/src/Ursa.Themes.Semi/Controls/ControlClassesInput.axaml
+++ b/src/Ursa.Themes.Semi/Controls/ControlClassesInput.axaml
@@ -10,5 +10,12 @@
+
+
+
+
+
+
+
diff --git a/src/Ursa/Controls/ControlClassesInput/ControlClassesInput.cs b/src/Ursa/Controls/ControlClassesInput/ControlClassesInput.cs
index 9a54bbb..2681256 100644
--- a/src/Ursa/Controls/ControlClassesInput/ControlClassesInput.cs
+++ b/src/Ursa/Controls/ControlClassesInput/ControlClassesInput.cs
@@ -74,13 +74,13 @@ public class ControlClassesInput: TemplatedControl
var newValue = args.NewValue.Value;
if (newValue is null)
{
- SaveHistory(new List());
+ SaveHistory(new List(), true);
return;
}
else
{
var classes = newValue.Where(a => !string.IsNullOrWhiteSpace(a)).Distinct().ToList();
- SaveHistory(classes);
+ SaveHistory(classes, true);
if (newValue is INotifyCollectionChanged incc)
{
incc.CollectionChanged+=InccOnCollectionChanged;
@@ -91,20 +91,20 @@ public class ControlClassesInput: TemplatedControl
private void InccOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
- SaveHistory(TargetClasses?.ToList() ?? new List());
+ SaveHistory(TargetClasses?.ToList() ?? new List(), true);
}
- private void SaveHistory(List strings)
+ private void SaveHistory(List strings, bool fromInput)
{
_history.AddLast(strings);
if (_history.Count > CountOfHistoricalRecord)
{
_history.RemoveFirst();
}
- SetClassesToTarget();
+ SetClassesToTarget(fromInput);
}
- private void SetClassesToTarget()
+ private void SetClassesToTarget(bool fromInput)
{
List strings;
if (_history.Count == 0)
@@ -115,6 +115,11 @@ public class ControlClassesInput: TemplatedControl
{
strings = _history.Last.Value;
}
+
+ if (!fromInput)
+ {
+ SetCurrentValue(TargetClassesProperty, new ObservableCollection(strings));
+ }
if (Target is not null)
{
Target.Classes.Replace(strings);
@@ -130,8 +135,8 @@ public class ControlClassesInput: TemplatedControl
var node = _history.Last;
_history.RemoveLast();
_undoHistory.AddFirst(node);
- SetCurrentValue(TargetClassesProperty, new AvaloniaList(node.Value));
- SetClassesToTarget();
+ SetCurrentValue(TargetClassesProperty, new ObservableCollection(node.Value));
+ SetClassesToTarget(false);
}
public void Redo()
@@ -139,12 +144,12 @@ public class ControlClassesInput: TemplatedControl
var node = _undoHistory.First;
_undoHistory.RemoveFirst();
_history.AddLast(node);
- SetCurrentValue(TargetClassesProperty, new AvaloniaList(node.Value));
- SetClassesToTarget();
+ SetCurrentValue(TargetClassesProperty, new ObservableCollection(node.Value));
+ SetClassesToTarget(false);
}
public void Clear()
{
- SaveHistory(new List());
+ SaveHistory(new List(), false);
}
}
\ No newline at end of file