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

XamlBindingHelper not returning right values #18855

Open
carldebilly opened this issue Nov 20, 2024 · 0 comments
Open

XamlBindingHelper not returning right values #18855

carldebilly opened this issue Nov 20, 2024 · 0 comments
Labels
difficulty/starter 🚀 Categorizes an issue for which the difficulty level is reachable by newcomers kind/bug Something isn't working project/core-tools 🛠️ Categorizes an issue or PR as relevant to core and tools

Comments

@carldebilly
Copy link
Member

carldebilly commented Nov 20, 2024

Description

When using XamlBindingHelper.Convert() to test the conversion of specific structures, there are noticeable behavioral differences between Windows (WinUI) and Uno. The expected behavior is that conversion of structures to string using Convert(typeof(string), value) should produce a format similar to .ToString() and should also support reconversion back to the original structure.

Below is a comparison table showing results on each platform and reconversion support for Uno:

Structure Windows Result Uno Result Reconversion Support (Uno)
Matrix(1, 2, 3, 4, 5, 6) 1,2,3,4,5,6 1,2,3,4,5,6 ✅ Yes
Thickness(1, 2, 3, 4) 1,2,3,4 [Thickness: 1-2-3-4] ❌ No
CornerRadius(1,2,3,4) 1,2,3,4 TopLeft: 1, TopRight: 2, BottomRight: 3, BottomLeft: 4 ❌ No
Duration(TimeSpan.FromSeconds(1)) 00:00:01 00:00:01 ✅ Yes
Duration.Automatic Automatic Automatic ✅ Yes
Duration.Forever Forever Forever ✅ Yes
GridLength(1, GridUnitType.Auto) Auto Auto ✅ Yes
GridLength(1, GridUnitType.Star) 1* * ✅ Yes
GridLength(1.5, GridUnitType.Star) 1.5* 1.5* ✅ Yes
GridLength(1, GridUnitType.Pixel) 1 1.0px ✅ Yes BUT WEIRD
GridLength(1.5, GridUnitType.Pixel) 1.5 1.5px ✅ Yes BUT WEIRD
Point(1, 2) 1,2 [1, 2] ❌ No
Rect(1, 2, 3, 4) 1,2,3,4 1,2,3,4 ✅ Yes
Size(1, 2) 1,2 1,2 ❌ No
Color (Colors.Beige) #FFF5F5DC #FFF5F5DC ✅ Yes

Issues to Address

  1. Conversions for Thickness and CornerRadius do not support reconversion to the original structure on Uno.
  2. Conversion of Point results in a different format ([1, 2]) on Uno and does not support reconversion.
  3. Desired format alignment between Uno and Windows for GridLength with pixel unit (1 vs 1.0px).

The goal is for Uno to properly support reconversion to the original structure, and ideally, to align output format with Windows (though this is less critical).

Expected behavior

Uno should be able to convert forward and convert backward to string for those structs. (to and from string).

How to reproduce it (as minimally and precisely as possible)

No response

Workaround

Not using the XamlBindingHelper

Works on UWP/WinUI

Yes

@carldebilly carldebilly added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Nov 20, 2024
@MartinZikmund MartinZikmund added project/core-tools 🛠️ Categorizes an issue or PR as relevant to core and tools difficulty/starter 🚀 Categorizes an issue for which the difficulty level is reachable by newcomers and removed triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/starter 🚀 Categorizes an issue for which the difficulty level is reachable by newcomers kind/bug Something isn't working project/core-tools 🛠️ Categorizes an issue or PR as relevant to core and tools
Projects
None yet
Development

No branches or pull requests

2 participants