[MAUI] Resolve compiled XAML warning - #229
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.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Source bindings need binding-level data types before source compilation can be enabled without XC0045 warnings and fallbacks.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1


No description provided.