-
Notifications
You must be signed in to change notification settings - Fork 679
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
Can't use x:Bind with Converter in Window #4966
Comments
@RealTommyKlein FYI |
Thanks for the report. The root of your Instead, you should move the UI logic ( |
Yeah, I too keep getting tripped up that Window isn't a If the expectation that This would help lead developers to the proper constructs when building their app and set them up for success vs. having everyone start dumping UI in I mean I really like how the |
But we have another problem: CustomTitleBar we can set only with XAML code in MainWindow.xaml, yes? Best issue about i want to say #2124 with a lot of scrennsots |
Coming from a strictly WPF/.NET Framework background, and trying out WinUI 3.x for the first time... this is really non-intuitive, especially when trying to port multi-window applications. I realize that there is a fundamental difference in how UWP apps behave versus how traditional multi-window applications behave, but there should be an elegant solution to this problem nonetheless. |
Isn't the Grid the root element ? the converter is defined in grid resources |
Can a sample / example be provided in WinUI docs (if recommendation is to restructure the xaml to expose a usercontrol in order to use a converter / static resource?) so people don't spend cycles figuring out why this simple thing is not working. I am trying to use a boolean to visibility converter and it is so time consuming this simple thing. |
|
I think this is a worthwhile point. The auto-gen code successfully finds a Grid at the element where the resource is placed. It then passes '*this' (which is the Window) to SetConverterLookupRoot. When it could just set it as the target.as that it's using for the SetDataRoot call. It's not a documentation issue. It's a autogen code issue with an inconsistent use of the term 'root' in the code block. e.g.:
Refactoring code to avoid this autogen issue or making it about documentation seems like it's not very customer-focused. Why do we need to read more and refactor code, when this seems like a minor, and easily changeable portion of the generated code? |
This is a bug in autogenerated code, of course, not a documentation issue. No one in their right mind creates a separate control for every page. I would even say that it is a critical bug which requires few hours to fix it, but due to the fact that tags assigned to the task are misleading, I guess it will not be fixed until 2030. |
This is a big problem, how did you remove the ease of functionality that was binding in WPF/UWP and replace it with this?? |
This is definitely a problem. Why must I create a FrameworkElement instead of a Window? |
Since this is still not working, is there any plan to address this? Apart from this not being mentioned anywhere except for these bug reports, this is insanely impractical and the mentioned workaround is nothing short of a hack... |
Hello Guys, Any plan to solve this issue ? |
@Reza-Noei Unfortunately I don't think MS views this as a problem, and there will never be a "fix" since they have abstracted the |
@GuildOfCalamity ty for the answer. Sad for Microsoft 😢. |
The work around suggests using a UserControl but I need to use a bool to vis converter in the TitleBar The TitleBar cant take a UserControl so how can we do this? |
The more familiar you are with WPF, the more confused you will be. |
This is very unintuitive for anyone familiar with WPF.
|
++ To all this. I am having this problem as well. It seems like both the generated code and the default template should be fixed. |
Describe the bug
Hi, I've tried to use the x:Bind with IValueConverter. But the project doesn't compile -
CS1503 Argument 1: cannot convert from 'TestApp.MainWindow' to 'Microsoft.UI.Xaml.FrameworkElement'
. Please take a look at the following code. What I do wrong?Steps to reproduce the bug
Expected behavior
Screenshots
Version Info
NuGet package version:
[WinUI 3 - Project Reunion 0.5: 0.5.6]
Windows app type:
Additional context
The text was updated successfully, but these errors were encountered: