Description
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
- Conversions for
ThicknessandCornerRadiusdo not support reconversion to the original structure on Uno. - Conversion of
Pointresults in a different format ([1, 2]) on Uno and does not support reconversion. - Desired format alignment between Uno and Windows for
GridLengthwith pixel unit (1vs1.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