[MAUI] Resolve compiled XAML warning#229
Draft
vicocz wants to merge 1 commit into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses .NET MAUI compiled XAML (XamlC) warnings by enabling binding-with-source compilation and adding x:DataType annotations throughout XAML so bindings can be compiled/validated against concrete view-model/model types.
Changes:
- Enabled compiled binding-with-source support via
MauiEnableXamlCBindingWithSourceCompilation. - Added
x:DataTypeto multiple pages/templates (and introduced a few new view-model helper types) to support compiled bindings. - Refactored several nested view-model/helper classes into top-level classes to make them usable from XAML
x:DataTypeand adjusted navigation usage accordingly.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| BrickController2/BrickController2/UI/ViewModels/ManualDeviceListPageViewModel.cs | Removes nested helper types now moved to standalone files for XAML typing. |
| BrickController2/BrickController2/UI/ViewModels/DevicePageViewModel.cs | Exposes item VM type for XAML x:DataType, passes navigation service to output VMs, and adjusts disconnect visibility. |
| BrickController2/BrickController2/UI/ViewModels/DeviceGroup.cs | New standalone group type for grouped CollectionView compiled bindings. |
| BrickController2/BrickController2/UI/ViewModels/DeviceEntry.cs | New standalone entry type for compiled bindings in manual device list. |
| BrickController2/BrickController2/UI/ViewModels/ControllerProfilePageViewModel.cs | Moves action/event helper view-models to top-level for XAML x:DataType. |
| BrickController2/BrickController2/UI/Pages/SettingsPage.xaml | Adds page-level x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/SequenceSharePage.xaml | Adds page-level x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/SequenceListPage.xaml | Adds page + item template x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/SequenceEditorPage.xaml | Adds page + item template x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/ScannerPageBase.xaml | Adds page-level x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/PlayerPage.xaml | Adds page + item template x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/ManualDeviceListPage.xaml | Adds page + group/item template x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/InputDeviceTesterPage.xaml | Adds page + group/item template x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/DeviceSettingsPage.xaml | Adds page-level x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/DevicePage.xaml | Adds page + bindable layout item x:DataType and simplifies IsVisible binding for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/DeviceListPage.xaml | Adds page + item template x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/CreationSharePage.xaml | Adds page-level x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/CreationPage.xaml | Adds page + item template x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/CreationListPage.xaml | Adds page + item template x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/ControllerProfilePage.xaml | Adds page + group/item template x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/ControllerActionPage.xaml | Adds page-level x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/ChannelSetupPage.xaml | Adds page-level x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Pages/AboutPage.xaml | Adds page-level x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Controls/SettingsControl.xaml | Adds control + template x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Controls/Dialogs.xaml | Adds item template x:DataType for compiled bindings. |
| BrickController2/BrickController2/UI/Controls/DeviceChannelSelector.xaml | Adds control x:DataType for compiled bindings. |
| BrickController2/BrickController2/BrickController2.csproj | Enables MAUI binding-with-source compilation to resolve XamlC warnings. |
Comments suppressed due to low confidence (1)
BrickController2/BrickController2/UI/ViewModels/DevicePageViewModel.cs:127
DisconnectAsyncwas widened tointernalsoDeviceOutputViewModelcan call it after being moved out of the parent class. If this method isn’t intended to be part of the view-model’s internal API, consider keeping itprivateand instead passing a disconnect delegate/service intoDeviceOutputViewModel(so the page VM doesn’t have to expose connection-management internals).
internal async Task DisconnectAsync()
{
if (_connectionTokenSource is not null && _connectionTask is not null)
{
_connectionTokenSource.Cancel();
await _connectionTask;
}
await Device.DisconnectAsync();
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+12
to
+16
| public DeviceEntry(IDeviceFactoryData deviceFactoryData, Device? instace) | ||
| { | ||
| DeviceFactoryData = deviceFactoryData; | ||
| ExistingDevice = instace; | ||
| Selected = instace != null; |
Comment on lines
+8
to
+12
| xmlns:local="clr-namespace:BrickController2.UI.Pages" | ||
| xmlns:viewModels="clr-namespace:BrickController2.UI.ViewModels" | ||
| xmlns:zxing="clr-namespace:ZXing.Net.Maui.Controls;assembly=ZXing.Net.MAUI.Controls" | ||
| x:Class="BrickController2.UI.Pages.CreationSharePage" | ||
| x:Class="BrickController2.UI.Pages.CreationSharePage" | ||
| x:DataType="viewModels:CreationSharePageViewModel" |
Comment on lines
+8
to
+12
| xmlns:local="clr-namespace:BrickController2.UI.Pages" | ||
| xmlns:viewModels="clr-namespace:BrickController2.UI.ViewModels" | ||
| xmlns:zxing="clr-namespace:ZXing.Net.Maui.Controls;assembly=ZXing.Net.MAUI.Controls" | ||
| x:Class="BrickController2.UI.Pages.SequenceSharePage" | ||
| x:Class="BrickController2.UI.Pages.SequenceSharePage" | ||
| x:DataType="viewModels:SequenceSharePageViewModel" |
Comment on lines
+8
to
+12
| xmlns:local="clr-namespace:BrickController2.UI.Pages" | ||
| xmlns:viewModels="clr-namespace:BrickController2.UI.ViewModels" | ||
| xmlns:zxing="clr-namespace:ZXing.Net.Maui.Controls;assembly=ZXing.Net.MAUI.Controls" | ||
| x:Class="BrickController2.UI.Pages.ScannerPageBase" | ||
| x:Class="BrickController2.UI.Pages.ScannerPageBase" | ||
| x:DataType="viewModels:ScannerPageViewModelBase" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.