Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Make WindowEx a FrameworkElement #174

Closed
veler opened this issue Jun 7, 2024 · 1 comment
Closed

Suggestion: Make WindowEx a FrameworkElement #174

veler opened this issue Jun 7, 2024 · 1 comment

Comments

@veler
Copy link

veler commented Jun 7, 2024

Hi,
First, thank you for this cool library !
I just hurt myself with this WinUI issue: microsoft/microsoft-ui-xaml#4966

Long story short, Window isn't a FrameworkElement and it breaks the WinUI Source Code Generator when we try to use a x:Bind with a Converter expression inside.

A workaround is to do something like this:

<WindowEx (or Window)>
    <MyUserControl />
</WindowEx>

and MyUserControl being:

<UserControl>
   <TextBlock Text="x:Bind ViewModel.MyText, Converter=...blablabla"/>
</UserControl>

This issue took me 2 hours, mainly because I'm more used to WPF than WinUI and as someone said on the issue I linked above:

Yeah, I too keep getting tripped up that Window isn't a DependencyObject... it's a bit weird.

So here is a suggestion, if I may:

Make WindowEx inheriting from Page or UserControl and expose every Window properties/methods into it. So, for example, the Width property of this UserControl based WindowEx would not control the width of the UserControl, but the width of the underlying window, which can also be exposed as a property of WindowEx.

What do you think?
Thanks

@dotMorten
Copy link
Owner

I can't really change the inheritance of Window. It needs to be a Window type, and WindowEx inherits from Window itself. This is on the Windows App SDK to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants