1
0
Steven Kirk 8 жил өмнө
parent
commit
dede306531

+ 6 - 6
src/Avalonia.Styling/Styling/Setter.cs

@@ -141,20 +141,20 @@ namespace Avalonia.Styling
             {
                 var description = style?.ToString();
 
-                if (sourceInstance.Subject != null)
+                if (sourceInstance.Mode == BindingMode.TwoWay || sourceInstance.Mode == BindingMode.OneWayToSource)
                 {
                     var activated = new ActivatedSubject(activator, sourceInstance.Subject, description);
                     cloned = new InstancedBinding(activated, sourceInstance.Mode, BindingPriority.StyleTrigger);
                 }
-                else if (sourceInstance.Observable != null)
+                else if (sourceInstance.Mode == BindingMode.OneTime)
                 {
-                    var activated = new ActivatedObservable(activator, sourceInstance.Observable, description);
-                    cloned = new InstancedBinding(activated, sourceInstance.Mode, BindingPriority.StyleTrigger);
+                    var activated = new ActivatedValue(activator, sourceInstance.Value, description);
+                    cloned = new InstancedBinding(activated, BindingMode.OneWay, BindingPriority.StyleTrigger);
                 }
                 else
                 {
-                    var activated = new ActivatedValue(activator, sourceInstance.Value, description);
-                    cloned = new InstancedBinding(activated, BindingMode.OneWay, BindingPriority.StyleTrigger);
+                    var activated = new ActivatedObservable(activator, sourceInstance.Observable ?? sourceInstance.Subject, description);
+                    cloned = new InstancedBinding(activated, sourceInstance.Mode, BindingPriority.StyleTrigger);
                 }
             }
             else