Skip to content

[MAUI] Resolve compiled XAML warning#229

Draft
vicocz wants to merge 1 commit into
defaultfrom
local/maui-compiled-bindings
Draft

[MAUI] Resolve compiled XAML warning#229
vicocz wants to merge 1 commit into
defaultfrom
local/maui-compiled-bindings

Conversation

@vicocz
Copy link
Copy Markdown
Owner

@vicocz vicocz commented May 26, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:DataType to 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:DataType and 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

  • DisconnectAsync was widened to internal so DeviceOutputViewModel can 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 it private and instead passing a disconnect delegate/service into DeviceOutputViewModel (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"
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