Skip to content

Fix XAML compiled binding warnings in DeviceTests.Runners by adding x:DataType attributes #30219

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Microsoft.Maui.TestUtils.DeviceTests.Runners.VisualRunner"
x:Class="Microsoft.Maui.TestUtils.DeviceTests.Runners.VisualRunner.Pages.HomePage"
x:DataType="local:HomeViewModel"
Title="Test Runner">

<Grid RowDefinitions="Auto,*,Auto,Auto,120" Padding="20" RowSpacing="10">
Expand All @@ -14,9 +16,9 @@
ItemsSource="{Binding TestAssemblies}"
SelectionMode="Single"
SelectionChangedCommand="{Binding NavigateToTestAssemblyCommand}"
SelectionChangedCommandParameter="{Binding SelectedItem, Source={Reference assemblyList}}">
SelectionChangedCommandParameter="{Binding SelectedItem, Source={Reference assemblyList}, x:DataType=CollectionView}">>
<CollectionView.ItemTemplate>
<DataTemplate>
<DataTemplate x:DataType="local:TestAssemblyViewModel">
<StackLayout Padding="20,10" Spacing="5">
<Label Text="{Binding DisplayName}" TextColor="{Binding RunStatus, Converter={StaticResource RunStatusToColorConverter}}" />
<StackLayout Orientation="Horizontal" Spacing="5">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Microsoft.Maui.TestUtils.DeviceTests.Runners.VisualRunner"
x:Class="Microsoft.Maui.TestUtils.DeviceTests.Runners.VisualRunner.Pages.TestAssemblyPage"
x:DataType="local:TestAssemblyViewModel"
Title="{Binding DisplayName}">

<Grid RowDefinitions="Auto,Auto,*,Auto" Padding="20" RowSpacing="10">
Expand Down Expand Up @@ -32,9 +33,9 @@
ItemsSource="{Binding TestCases}"
SelectionMode="Single"
SelectionChangedCommand="{Binding NavigateToResultCommand}"
SelectionChangedCommandParameter="{Binding SelectedItem, Source={Reference testsList}}">
SelectionChangedCommandParameter="{Binding SelectedItem, Source={Reference testsList}, x:DataType=CollectionView}">>
<CollectionView.ItemTemplate>
<DataTemplate>
<DataTemplate x:DataType="local:TestCaseViewModel">
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the wrong datatype. It should be the datatype that TestCases leads to.

Copy link
Member

Choose a reason for hiding this comment

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

I think the property is TestCaseViewModel:

public IList<TestCaseViewModel> TestCases => _filteredTests;

<StackLayout Padding="20,10" Spacing="5">
<Label Text="{Binding DisplayName}" />
<Label Text="{Binding Message}" TextColor="{Binding RunStatus, Converter={StaticResource RunStatusToColorConverter}}" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Microsoft.Maui.TestUtils.DeviceTests.Runners.VisualRunner"
x:Class="Microsoft.Maui.TestUtils.DeviceTests.Runners.VisualRunner.Pages.TestResultPage"
x:DataType="local:TestResultViewModel"
Title="Test Result">

<ScrollView>
Expand Down