-
Notifications
You must be signed in to change notification settings - Fork 742
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
[Desktop] x:Bind local does not work in Custom Control #18404
Comments
@MartinZikmund: still not working on |
@kucint This was more complex than I originally hoped. I think the PR I opened has the fix, but will need to validate it against all tests. In the meantime a good way to workaround this could be to define the constants in XAML insted, e.g. in a resource dictionary you can do: <x:Double x:Name="MyControlSize">200</x:Double> And then use the resource in the template: Width="{StaticResource MyControlSize}" Ultimately the result should be equivalent, even performance-wise (and could actually even be more performant). |
@MartinZikmund : defining constants in resources is XAML is not an option to me. |
@kucint hopefully my PR will avoid the need for this, but yes, you could set the resources early on app startup from C#, it would have the same end result, while keeping the consts in C# |
I upgraded my test app to the newest dotnet and newest "Uno.Sdk": "5.5.43": XBindLocalApp.zip |
@MartinZikmund |
The change is not present in uno 5.5, it will only be in Uno 5.6 at this time. |
I see, is it present in dev branch? |
Not yet, we're currently ingesting the .NET 9 changes. It will be available in the dev branch most likely in the next few days. |
Thanks @jeromelaban for info. |
Current behavior
Issue 1
binding to local constant works in
Page
but not working inControl
Code behind:
Issue 2
Discrepancy between
WinAppSDK
andDesktop
:WinAppSDK
works fine withprivate const
whileDesktop
requirespublic const
WinAppSDK
Desktop
Expected behavior
binding to local constant shall work in
Control
How to reproduce it (as minimally and precisely as possible)
MINIMAL REPRO PROJECT: XBindLocalApp.zip
STEPS TO REPRODUCE:
run the app on Windows with
WinAppSDK
framework selected: all works fine:run the app on Windows with
Desktop
framework selected: binding works inPage
but fails inControl
Workaround
define constant in XAML rather than in C# code behind
Works on UWP/WinUI
Yes
Environment
No response
NuGet package version(s)
"Uno.Sdk": "5.4.8"
Affected platforms
Skia (WPF)
IDE
Visual Studio 2022
IDE version
No response
Relevant plugins
No response
Anything else we need to know?
No response
The text was updated successfully, but these errors were encountered: