浏览代码

Merge pull request #10065 from danielmayost/fixFDPopupBug

Make TopLevel can't be in MirrorTransform state
Max Katz 2 年之前
父节点
当前提交
4e223040e4
共有 2 个文件被更改,包括 8 次插入1 次删除
  1. 1 1
      samples/ControlCatalog/MainView.xaml.cs
  2. 7 0
      src/Avalonia.Controls/TopLevel.cs

+ 1 - 1
samples/ControlCatalog/MainView.xaml.cs

@@ -60,7 +60,7 @@ namespace ControlCatalog
             {
             {
                 if (flowDirections.SelectedItem is FlowDirection flowDirection)
                 if (flowDirections.SelectedItem is FlowDirection flowDirection)
                 {
                 {
-                    this.FlowDirection = flowDirection;
+                    TopLevel.GetTopLevel(this).FlowDirection = flowDirection;
                 }
                 }
             };
             };
 
 

+ 7 - 0
src/Avalonia.Controls/TopLevel.cs

@@ -615,6 +615,13 @@ namespace Avalonia.Controls
                 KeyboardDevice.Instance?.SetFocusedElement(null, NavigationMethod.Unspecified, KeyModifiers.None);
                 KeyboardDevice.Instance?.SetFocusedElement(null, NavigationMethod.Unspecified, KeyModifiers.None);
         }
         }
 
 
+        protected override bool BypassFlowDirectionPolicies => true;
+
+        public override void InvalidateMirrorTransform()
+        {
+            // Do nothing becuase TopLevel should't apply MirrorTransform on himself.
+        }
+
         ITextInputMethodImpl? ITextInputMethodRoot.InputMethod =>
         ITextInputMethodImpl? ITextInputMethodRoot.InputMethod =>
             (PlatformImpl as ITopLevelImplWithTextInputMethod)?.TextInputMethod;
             (PlatformImpl as ITopLevelImplWithTextInputMethod)?.TextInputMethod;
     }
     }