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

Merged
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
4 changes: 2 additions & 2 deletions src/ClientApp/ClientApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<MauiEnableXamlCBindingWithSourceCompilation>false</MauiEnableXamlCBindingWithSourceCompilation>
<MauiEnableXamlCBindingWithSourceCompilation>true</MauiEnableXamlCBindingWithSourceCompilation>
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
<NoWarn>$(NoWarn);XC0022;XC0023;XC0025;XC0103</NoWarn>
<NoWarn>$(NoWarn);XC0103</NoWarn>

<!-- Display name -->
<ApplicationTitle>AdventureWorks</ApplicationTitle>
Expand Down
2 changes: 1 addition & 1 deletion src/ClientApp/Views/BasketView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Grid.Row="0"
ItemsSource="{Binding BasketItems}"
SelectionChangedCommand="{Binding AddCommand}"
SelectionChangedCommandParameter="{Binding SelectedItem, Source={RelativeSource Self}}">
SelectionChangedCommandParameter="{Binding SelectedItem, Source={RelativeSource Self}, x:DataType=CollectionView}">
<CollectionView.ItemTemplate>
<DataTemplate>
<templates:BasketItemTemplate />
Expand Down
10 changes: 5 additions & 5 deletions src/ClientApp/Views/CatalogView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
Scrolled="Products_OnScrolled"
SelectedItem="{Binding SelectedProduct, Mode=TwoWay}"
SelectionChangedCommand="{Binding ViewCatalogItemCommand, Mode=OneTime}"
SelectionChangedCommandParameter="{Binding SelectedItem, Source={RelativeSource Self}}"
SelectionChangedCommandParameter="{Binding SelectedItem, Source={RelativeSource Self}, x:DataType=CollectionView}"
SelectionMode="Single"
VerticalScrollBarVisibility="Never">
<CollectionView.Header>
Expand Down Expand Up @@ -161,13 +161,13 @@
<DataTemplate x:DataType="viewmodels:CatalogBrandSelectionViewModel">
<Button
Margin="4"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodels:CatalogViewModel}}, Path=SelectCatalogBrandCommand}"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodels:CatalogViewModel}}, Path=SelectCatalogBrandCommand, x:DataType=viewmodels:CatalogViewModel}"
CommandParameter="{Binding Value}"
Style="{StaticResource TransparentButtonStyle}"
Text="{Binding Value.Brand, Mode=OneTime}">
<Button.Triggers>
<DataTrigger
Binding="{Binding Selected}"
Binding="{Binding Selected, x:DataType=viewmodels:CatalogBrandSelectionViewModel}"
TargetType="Button"
Value="True">
<Setter Property="TextColor" Value="{StaticResource HighlightColor}" />
Expand All @@ -191,13 +191,13 @@
<DataTemplate x:DataType="viewmodels:CatalogTypeSelectionViewModel">
<Button
Margin="4"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodels:CatalogViewModel}}, Path=SelectCatalogTypeCommand}"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodels:CatalogViewModel}}, Path=SelectCatalogTypeCommand, x:DataType=viewmodels:CatalogViewModel}"
CommandParameter="{Binding Value}"
Style="{StaticResource TransparentButtonStyle}"
Text="{Binding Value.Type, Mode=OneTime}">
<Button.Triggers>
<DataTrigger
Binding="{Binding Selected}"
Binding="{Binding Selected, x:DataType=viewmodels:CatalogTypeSelectionViewModel}"
TargetType="Button"
Value="True">
<Setter Property="TextColor" Value="{StaticResource HighlightColor}" />
Expand Down
4 changes: 2 additions & 2 deletions src/ClientApp/Views/FiltersView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
<Picker
Title="BRAND"
ios:Picker.UpdateMode="WhenFinished"
ItemDisplayBinding="{Binding Brand}"
ItemDisplayBinding="{Binding Value.Brand, x:DataType=viewmodels:CatalogBrandSelectionViewModel}"
ItemsSource="{Binding Brands}"
SelectedItem="{Binding SelectedBrand, Mode=TwoWay}" />
<!-- TYPE -->
<Picker
Title="TYPE"
ios:Picker.UpdateMode="WhenFinished"
ItemDisplayBinding="{Binding Type}"
ItemDisplayBinding="{Binding Value.Type, x:DataType=viewmodels:CatalogTypeSelectionViewModel}"
ItemsSource="{Binding Types}"
SelectedItem="{Binding SelectedType, Mode=TwoWay}" />
<Button Command="{Binding FilterCommand}" Text="Apply">
Expand Down
2 changes: 1 addition & 1 deletion src/ClientApp/Views/ProfileView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
ItemsSource="{Binding Orders}"
SelectedItem="{Binding SelectedOrder, Mode=TwoWay}"
SelectionChangedCommand="{Binding OrderDetailCommand}"
SelectionChangedCommandParameter="{Binding SelectedItem, Source={RelativeSource Self}}"
SelectionChangedCommandParameter="{Binding SelectedItem, Source={RelativeSource Self}, x:DataType=CollectionView}"
SelectionMode="Single">
<CollectionView.ItemTemplate>
<DataTemplate>
Expand Down
4 changes: 2 additions & 2 deletions src/ClientApp/Views/Templates/BasketItemTemplate.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<SwipeItems>
<SwipeItem
BackgroundColor="Red"
Command="{Binding Source={RelativeSource AncestorType={x:Type vm:BasketViewModel}}, Path=DeleteCommand}"
Command="{Binding Source={RelativeSource AncestorType={x:Type vm:BasketViewModel}}, Path=DeleteCommand, x:DataType=vm:BasketViewModel}"
CommandParameter="{Binding}"
Text="Delete" />
</SwipeItems>
Expand Down Expand Up @@ -101,7 +101,7 @@
<!-- DELETE BUTTON IF ON DESKTOP -->
<Button
Grid.Row="2"
Command="{Binding Source={RelativeSource AncestorType={x:Type vm:BasketViewModel}}, Path=DeleteCommand}"
Command="{Binding Source={RelativeSource AncestorType={x:Type vm:BasketViewModel}}, Path=DeleteCommand, x:DataType=vm:BasketViewModel}"
CommandParameter="{Binding}"
HorizontalOptions="Start"
IsVisible="{OnIdiom False,
Expand Down
Loading