Is the compatibility namespace usable? #15043
Replies: 3 comments
-
I was able to strip this down even more, so it literally was just the <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:compat="clr-namespace:Microsoft.Maui.Controls.Compatibility;assembly=Microsoft.Maui.Controls">
<compat:Grid ColumnDefinitions="24, *"
ColumnSpacing="16">
<ContentView Grid.Column="0">
<Image Source="https://images.pexels.com/photos/850359/pexels-photo-850359.jpeg?cs=srgb&dl=pexels-jess-bailey-designs-850359.jpg&fm=jpg"
HeightRequest="24"
WidthRequest="24">
</Image>
</ContentView>
<Label Text="Pretty Flower" Grid.Column="1" />
</compat:Grid>
</ContentPage> |
Beta Was this translation helpful? Give feedback.
-
@hartez do you have any thoughts on this? Are the layouts in the compatibility namespace expected to behave like the Xamarin version? It's completely fine if the answer is "don't use the compatibility layouts". I just don't want to spend time figuring out another solution if the compat namespace is supposed to be usable in the way I'm describing. |
Beta Was this translation helpful? Give feedback.
-
Filed a bug for this: #15454, so going to go ahead and close the discussion. |
Beta Was this translation helpful? Give feedback.
-
I deal in an area where I take a lot of XAML dynamically, and parse it on the fly (using
LoadFromXaml
). There have been hundreds of thousands of lines of XAML (for Xamarin) written this way.I understand the caveats of having to move to a new framework, and definitely will encourage people to update their XAML, but I want to make the process as easy as possible. I thought the
Microsoft.Maui.Controls.Compatibility
namespace was my answer. I wanted to add a compatibility layer that when enabled, mapped the corresponding elements to their compatibility version, like such:Then when looping through the incoming XAML, process it like such.
This method successfully maps all of the available elements to the "compat" namespace (
Microsoft.Maui.Controls.Compatibility
)....But that's when things started going wrong. It seems like the compatibility elements.. barely work.
Without ANY of the parsing above, take the following XAML. Specifically the
Grid
:Displays something completely wrong:
![image](https://private-user-images.githubusercontent.com/11482832/237824075-ee1fa34e-a85c-482e-9e1e-fdcd8f918bd1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxOTYxNjgsIm5iZiI6MTczOTE5NTg2OCwicGF0aCI6Ii8xMTQ4MjgzMi8yMzc4MjQwNzUtZWUxZmEzNGUtYTg1Yy00ODJlLTllMWUtZmRjZDhmOTE4YmQxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDEzNTc0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU4ZDU2MWFkNTU0M2Q0ZDUzYWU3MjQyNjMwZGNhNTczMGRhNTZiNWY4YjI5NDAyMDA0NTVmMGYyMGQ1ZjIxYTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.H4CNpg9sjcdfQjH-nhnv6y33j9fmRyL1CbTDNK-0ixU)
When I remove the
compat
namespacing, everything looks normal.That is just one issue I'm encountering, the other compat elements have some problems too (see #12415 (comment))
I guess there is just some unclarity:
Thanks for taking the time to read this, any help or advice would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions