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

Fix XamlC warnings in .NET MAUI app #585

Conversation

simonrozsival
Copy link
Member

This PR fixes XamlC warnings in the .NET MAUI app that are related to @jamesmontemagno's upgrade to .NET 9.

The changes are straightforward. It was only necessary to add the missing x:DataType attribute to the XAML files and reenable the warnings. Adding the annotations revealed that the FiltersView.xaml bindings were incorrect (even though this make little impact since as far as I can tell it isn't used currently).

This is a prerequisite to making this app work with NativeAOT. It will be still necessary to switch to source-generated JSON serialization and update the CommunityToolkit once it supports .NET 9 and NativeAOT.

@jamesmontemagno jamesmontemagno merged commit 85701ba into dotnet:maui-dotnet9 Oct 21, 2024
3 checks passed
jamesmontemagno added a commit that referenced this pull request Oct 31, 2024
* Update project to .NET 9.0 and various code improvements

Updated App.xaml.cs to override CreateWindow and adjust SetStatusBar.
Targeted .NET 9.0 in ClientApp.csproj and updated packages.
Removed XML declarations from Styles.xaml and view files.
Handled end group tags in Basket.cs protobuf parsing.
Changed DisplayAlert usage in DialogService.cs.
Modified TitleUseAzureServices property in SettingsViewModel.cs.
Updated ClientApp.UnitTests.csproj with newer package versions.

* Refactor App initialization and update dependencies

Updated App.xaml.cs to use CreateWindow method for main window initialization.
Repositioned ManagePackageVersionsCentrally in HybridApp.csproj.
Updated SupportedOSPlatformVersion for iOS and MacCatalyst to 15.0.
Upgraded PackageReference versions to 9.0.0-rc.2.
Reformatted Routes.razor and _Imports.razor for consistency.

* Update network settings for Android and iOS

- MainPage.xaml: Added XML namespace `local` for `eShop.HybridApp.Components`.
- MauiProgram.cs: Updated `MobileBffHost` URL for Android to `http://10.0.2.2:11632/` and kept `http://localhost:11632/` for other platforms.
- AndroidManifest.xml: Enabled cleartext traffic and added network security config.
- Info.plist: Relaxed network security policies to allow HTTP connections.
- network_security_config.xml: Created to permit cleartext traffic for `10.0.2.2`.

* Add Basket.API project to ClientApp solution

Added Basket.API project to ClientApp.sln with GUID {0F0B89AF-EDEA-4479-941A-CCE9FFDBD057}. Updated solution configuration platforms to include build and active configuration settings for Debug and Release configurations.

* not needed

* Fix XamlC warnings in .NET MAUI app (#585)

* Add missing x:DataType

* Reenable warnings

* Update some styles

* Update src/HybridApp/App.xaml.cs

Co-authored-by: Eilon Lipton <[email protected]>

* Use source-generated JSON serialization in .NET MAUI app (#587)

* Use source-generated JSON serialization in ClientApp

* Refactor serialization of JSON content

* Add ConfigureHandlers method for iOS and Mac Catalyst

The MauiProgram class has been updated to include a new method
ConfigureHandlers. This method is conditionally compiled for
iOS and Mac Catalyst platforms and adds custom handlers for
CollectionView and CarouselView controls. The ConfigureHandlers
method is called in the CreateMauiApp method to ensure these
handlers are configured during the app's initialization.

* Remove Grid.ColumnSpan="0" from <Image> in LoginView.xaml

Removed the Grid.ColumnSpan="0" attribute from the <Image> element
in LoginView.xaml. This attribute was likely incorrect or
unnecessary, and its removal may correct the layout behavior of
the image within the grid.

* Refactor LoginView.xaml layout and clean up code

- Added `LoginPanel` grid with specific properties and bindings.
- Introduced a new logo image element for better visual structure.
- Reformatted and re-added the login button with necessary properties.
- Removed commented-out `<ScrollView>`, `<ContentView>`, and register button.
- Enhanced code readability by eliminating unused commented code.

---------

Co-authored-by: Šimon Rozsíval <[email protected]>
Co-authored-by: Eilon Lipton <[email protected]>
Co-authored-by: James Montemagno <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants