microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

No Window.FlowDirection support for desktop applications

Open riverar opened this issue 4 years ago • 8 comments

WinUI XAML does not support FlowDirection or equivalent attribute on the Window element. Additionally, the Window class does not contain a FlowDirection property for programmatic access.

This impacts developers migrating from WPF XAML or WinRT XAML and overall global readiness.

Potential workaround:

// ...
var native_window = managed_window.As<IWindowNative>();
var extended_style = GetWindowLong(native_window.WindowHandle, GWL_EXSTYLE);
SetWindowLong(native_window.WindowHandle, GWL_EXSTYLE, extended_style | WS_EX_LAYOUTRTL);
managed_window.Activate();
// ...

Steps to reproduce the bug

  1. File > New > WinUI 3 blank desktop packaged application
  2. Attempt to add FlowDirection=FlowDirection.RightToLeft attribute to root Window element in MainWindow.xaml
  3. Observe error

Expected behavior Easy way to enable RTL support via XAML and programmatically.

Version Info NuGet package version: Microsoft.WinUI 3.0.0-preview4.210210.4

Windows app type:

UWP Win32
Yes
Windows 10 version Saw the problem?
Insider Build (21313) Yes
October 2020 Update (19042)
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

riverar avatar Feb 16 '21 22:02 riverar

@codendone FYI

StephenLPeters avatar Feb 17 '21 00:02 StephenLPeters

@Austin-Lamb FYI

StephenLPeters avatar Feb 17 '21 00:02 StephenLPeters

Marking this as a feature proposal and throwing it into the freezer is very disappointing.

This is missing i18n functionality, something Microsoft would once consider a blocker to shipping. Everyone that wants to support RTL will now have to have to manually plumb in the necessary interfaces and P/Invoke signatures (C#/Win32 does not support WinUI) to support something supported in WinForms over a decade ago. WinUI Preview 3 didn't even properly support WS_EX_LAYOUTRTL, so I can only imagine what bugs lie in wait.

riverar avatar Feb 17 '21 07:02 riverar

@riverar, you are right this is basic funtionality that should be there, but it requires a new APIs, and new APIs is a feature request.

marb2000 avatar Feb 20 '21 05:02 marb2000

Hi, is there any workaround for this that can be used from C#?

mhmd-azeez avatar Oct 31 '21 20:10 mhmd-azeez

@marb2000 FYI

StephenLPeters avatar Nov 01 '21 17:11 StephenLPeters

any news on this item?

ahass avatar Dec 20 '22 13:12 ahass

Any news?

mindaugasveblauskas avatar Feb 14 '24 11:02 mindaugasveblauskas