Skip to content

Commit 4426133

Browse files
Address Maui xamlc warnings (#1695)
Co-authored-by: praveenaa <[email protected]>
1 parent 753a74d commit 4426133

File tree

44 files changed

+188
-114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+188
-114
lines changed

src/MAUI/Maui.Samples/ArcGIS.Samples.Maui.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">win-x86;win-x64;win-arm64</RuntimeIdentifiers>
3232
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows' AND '$(Platform)' == 'AnyCPU'">win-x64</RuntimeIdentifier>
3333
<AppxPackageDir>..\..\..\output\$(RuntimeIdentifier)\</AppxPackageDir>
34-
<NoWarn>$(NoWarn);XC0022;XC0025</NoWarn> <!-- Disable XamlC warnings until addressed -->
34+
<MauiEnableXamlCBindingWithSourceCompilation>true</MauiEnableXamlCBindingWithSourceCompilation>
3535
</PropertyGroup>
3636

3737
<ItemGroup>

src/MAUI/Maui.Samples/Samples/Data/CreateMobileGeodatabase/CreateMobileGeodatabase.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<ContentPage x:Class="ArcGIS.Samples.CreateMobileGeodatabase.CreateMobileGeodatabase"
22
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
45
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Maui;assembly=Esri.ArcGISRuntime.Maui">
56
<Grid Style="{DynamicResource EsriSampleContainer}">
67
<esriUI:MapView x:Name="MyMapView" Style="{DynamicResource EsriSampleGeoView}" />
@@ -51,7 +52,7 @@
5152
</Grid>
5253
</ListView.Header>
5354
<ListView.ItemTemplate>
54-
<DataTemplate>
55+
<DataTemplate x:DataType="esri:Feature">
5556
<ViewCell>
5657
<Grid ColumnDefinitions="*,*">
5758
<Label Grid.Column="0"

src/MAUI/Maui.Samples/Samples/Data/EditFeatureAttachments/EditFeatureAttachments.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<ContentPage x:Class="ArcGIS.Samples.EditFeatureAttachments.EditFeatureAttachments"
22
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
45
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Maui;assembly=Esri.ArcGISRuntime.Maui">
56
<ContentPage.Resources>
67
<Style x:Key="IconStyle" TargetType="Button">
@@ -26,7 +27,7 @@
2627
IsEnabled="False">
2728
<!-- ItemTemplate defines how each item (Attachment) is rendered. -->
2829
<ListView.ItemTemplate>
29-
<DataTemplate>
30+
<DataTemplate x:DataType="esri:Attachment">
3031
<ViewCell>
3132
<Grid ColumnDefinitions="*,auto,auto" RowDefinitions="auto">
3233
<Label Margin="5"

src/MAUI/Maui.Samples/Samples/Data/EditFeaturesUsingFeatureForms/EditFeaturesUsingFeatureForms.xaml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,34 @@
44
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Maui;assembly=Esri.ArcGISRuntime.Maui"
55
xmlns:toolkit="clr-namespace:Esri.ArcGISRuntime.Toolkit.Maui;assembly=Esri.ArcGISRuntime.Toolkit.Maui">
66
<Grid>
7-
<esriUI:MapView x:Name="MyMapView"
8-
GeoViewTapped="MyMapView_GeoViewTapped" />
7+
<esriUI:MapView x:Name="MyMapView" GeoViewTapped="MyMapView_GeoViewTapped" />
98
<Grid x:Name="FeatureFormPanel"
10-
IsVisible="False" Padding="20"
11-
BackgroundColor="{AppThemeBinding Light=White, Dark=Black}">
9+
Padding="20"
10+
BackgroundColor="{AppThemeBinding Light=White,
11+
Dark=Black}"
12+
IsVisible="False">
1213
<Grid.RowDefinitions>
1314
<RowDefinition Height="*" />
1415
<RowDefinition Height="Auto" />
1516
</Grid.RowDefinitions>
1617
<ScrollView Grid.Row="0" MaximumWidthRequest="400">
1718
<toolkit:FeatureFormView x:Name="FeatureFormViewPanel" />
1819
</ScrollView>
19-
<Grid Grid.Row="1" ColumnSpacing="10" MaximumWidthRequest="400">
20+
<Grid Grid.Row="1"
21+
ColumnSpacing="10"
22+
MaximumWidthRequest="400">
2023
<Grid.ColumnDefinitions>
2124
<ColumnDefinition Width="*" />
2225
<ColumnDefinition Width="*" />
2326
</Grid.ColumnDefinitions>
24-
<Button Text="Save"
25-
Grid.Column="0"
27+
<Button Grid.Column="0"
28+
x:DataType="toolkit:FeatureFormView"
2629
Clicked="SaveButton_Clicked"
27-
IsEnabled="{Binding Source={x:Reference FeatureFormViewPanel}, Path=IsValid}" />
28-
<Button Text="Cancel"
29-
Grid.Column="1"
30-
Clicked="CancelButton_Clicked" />
30+
IsEnabled="{Binding Source={x:Reference FeatureFormViewPanel}, Path=IsValid}"
31+
Text="Save" />
32+
<Button Grid.Column="1"
33+
Clicked="CancelButton_Clicked"
34+
Text="Cancel" />
3135
</Grid>
3236
</Grid>
3337
</Grid>

src/MAUI/Maui.Samples/Samples/Data/ReadShapefileMetadata/ReadShapefileMetadata.xaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22
<ContentPage x:Class="ArcGIS.Samples.ReadShapefileMetadata.ReadShapefileMetadata"
33
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
44
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
5+
xmlns:controls="clr-namespace:Microsoft.Maui.Controls;assembly=Microsoft.Maui.Controls"
6+
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
57
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Maui;assembly=Esri.ArcGISRuntime.Maui">
8+
69
<Grid Style="{DynamicResource EsriSampleContainer}">
710
<esriUI:MapView x:Name="MyMapView" Style="{DynamicResource EsriSampleGeoView}" />
811
<Border x:Name="ControlPanel" Style="{DynamicResource EsriSampleControlPanel}">
9-
<ScrollView MaximumHeightRequest="{OnIdiom Desktop=500, Default={Binding Height, Source=ControlPanel}}" Orientation="{OnPlatform iOS=Both, Default=Vertical}">
10-
<StackLayout x:Name="InfoList" Spacing="5">
12+
<ScrollView x:DataType="controls:Border"
13+
MaximumHeightRequest="{OnIdiom Desktop=500, Default={Binding Height, Source=ControlPanel}}"
14+
Orientation="{OnPlatform iOS=Both, Default=Vertical}">
15+
<StackLayout x:Name="InfoList"
16+
x:DataType="esri:ShapefileInfo"
17+
Spacing="5">
1118
<Label FontAttributes="Bold"
1219
FontSize="Large"
1320
HorizontalOptions="Start"

src/MAUI/Maui.Samples/Samples/Data/StatsQueryGroupAndSort/StatsQueryGroupAndSort.xaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<ContentPage x:Name="StatsQueryGroupAndSortSample"
33
x:Class="ArcGIS.Samples.StatsQueryGroupAndSort.StatsQueryGroupAndSort"
44
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
5-
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
5+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
6+
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
7+
xmlns:local="clr-namespace:ArcGIS.Samples.StatsQueryGroupAndSort">
68

79
<ContentPage.Resources>
810
<ResourceDictionary>
@@ -42,7 +44,7 @@
4244
SelectionMode="Single"
4345
Style="{DynamicResource CollectionViewStyle}">
4446
<CollectionView.ItemTemplate>
45-
<DataTemplate>
47+
<DataTemplate x:DataType="esri:StatisticDefinition">
4648
<Grid ColumnDefinitions="*,*">
4749
<Label Text="{Binding OnFieldName}" />
4850
<Label Grid.Column="1" Text="{Binding StatisticType}" />
@@ -56,7 +58,7 @@
5658
<Label FontAttributes="Bold" Text="Group by" />
5759
<CollectionView x:Name="GroupFieldsListBox" Style="{DynamicResource CollectionViewStyle}">
5860
<CollectionView.ItemTemplate>
59-
<DataTemplate>
61+
<DataTemplate x:DataType="esri:Field">
6062
<Grid ColumnDefinitions="50,*">
6163
<Switch HorizontalOptions="Start" Toggled="GroupField_Toggled" />
6264
<Label Grid.Column="1"
@@ -70,7 +72,7 @@
7072
<Label FontAttributes="Bold" Text="Order by" />
7173
<CollectionView x:Name="OrderByFieldsListBox" Style="{DynamicResource CollectionViewStyle}">
7274
<CollectionView.ItemTemplate>
73-
<DataTemplate>
75+
<DataTemplate x:DataType="local:OrderFieldOption">
7476
<Grid ColumnDefinitions="50, 2*, 2*">
7577
<Switch IsToggled="{Binding OrderWith}" />
7678
<Label Grid.Column="1"
@@ -103,14 +105,14 @@
103105
MaximumHeightRequest="{OnIdiom Default=800,
104106
Phone=600}">
105107
<CollectionView.GroupHeaderTemplate>
106-
<DataTemplate>
108+
<DataTemplate x:DataType="local:ResultGroup">
107109
<Label FontAttributes="Bold"
108110
FontSize="Medium"
109111
Text="{Binding GroupName}" />
110112
</DataTemplate>
111113
</CollectionView.GroupHeaderTemplate>
112114
<CollectionView.ItemTemplate>
113-
<DataTemplate>
115+
<DataTemplate x:DataType="local:StatisticResult">
114116
<HorizontalStackLayout Spacing="5">
115117
<Label FontAttributes="Bold" Text="{Binding FieldName}" />
116118
<Label Text="{Binding StatValue}" />

src/MAUI/Maui.Samples/Samples/Geometry/CreateAndEditGeometries/CreateAndEditGeometries.xaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545
Grid.Row="0"
4646
Grid.Column="1"
4747
Clicked="MultipointButton_Click"
48-
Style="{StaticResource IconStyle}"
49-
ToolTipProperties.Text="Multipoint"
5048
FontFamily="CalciteUIIconsSmallFontFamily"
5149
FontSize="16"
52-
Text="&#xe9f9; &#xe9f9;" />
50+
Style="{StaticResource IconStyle}"
51+
Text="&#xe9f9; &#xe9f9;"
52+
ToolTipProperties.Text="Multipoint" />
5353
<Button x:Name="PolylineButton"
5454
Grid.Row="1"
5555
Clicked="PolylineButton_Click"
@@ -91,42 +91,42 @@
9191
</Border>
9292
<Button Grid.Row="4"
9393
Clicked="UndoButton_Click"
94-
IsEnabled="{Binding GeometryEditor.CanUndo, Source={x:Reference MyMapView}}"
94+
IsEnabled="{Binding GeometryEditor.CanUndo, Source={x:Reference MyMapView}, x:DataType=esriUI:MapView}"
9595
Style="{StaticResource IconStyle}"
9696
Text="{StaticResource CalciteUIIcons_Glyph_Undo}"
9797
ToolTipProperties.Text="Undo" />
9898
<Button Grid.Row="4"
9999
Grid.Column="1"
100100
Clicked="RedoButton_Click"
101-
IsEnabled="{Binding GeometryEditor.CanRedo, Source={x:Reference MyMapView}}"
101+
IsEnabled="{Binding GeometryEditor.CanRedo, Source={x:Reference MyMapView}, x:DataType=esriUI:MapView}"
102102
Style="{StaticResource IconStyle}"
103103
Text="{StaticResource CalciteUIIcons_Glyph_Redo}"
104104
ToolTipProperties.Text="Redo" />
105105
<Button Grid.Row="5"
106106
Clicked="DeleteSelectedButton_Click"
107-
IsEnabled="{Binding GeometryEditor.SelectedElement.CanDelete, Source={x:Reference MyMapView}, FallbackValue=False}"
107+
IsEnabled="{Binding GeometryEditor.SelectedElement.CanDelete, Source={x:Reference MyMapView}, FallbackValue=False, x:DataType=esriUI:MapView}"
108108
Style="{StaticResource IconStyle}"
109109
Text="{StaticResource CalciteUIIcons_Glyph_Erase}"
110110
ToolTipProperties.Text="Delete selected" />
111111
<Button x:Name="SaveButton"
112112
Grid.Row="5"
113113
Grid.Column="1"
114114
Clicked="SaveButton_Click"
115-
IsEnabled="{Binding GeometryEditor.CanUndo, Source={x:Reference MyMapView}}"
115+
IsEnabled="{Binding GeometryEditor.CanUndo, Source={x:Reference MyMapView}, x:DataType=esriUI:MapView}"
116116
Style="{StaticResource IconStyle}"
117117
Text="{StaticResource CalciteUIIcons_Glyph_CheckCircle}"
118118
ToolTipProperties.Text="Save edits" />
119119
<Button Grid.Row="6"
120120
Clicked="DiscardButton_Click"
121-
IsEnabled="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}}"
121+
IsEnabled="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}, x:DataType=esriUI:MapView}"
122122
Style="{StaticResource IconStyle}"
123123
Text="{StaticResource CalciteUIIcons_Glyph_CircleDisallowed}"
124124
ToolTipProperties.Text="Discard edits" />
125125
<Button x:Name="DeleteAllButton"
126126
Grid.Row="6"
127127
Grid.Column="1"
128128
Clicked="DeleteAllButton_Click"
129-
IsEnabled="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}, Converter={StaticResource InvertedBoolConverter}}"
129+
IsEnabled="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}, Converter={StaticResource InvertedBoolConverter}, x:DataType=esriUI:MapView}"
130130
Style="{StaticResource IconStyle}"
131131
Text="{StaticResource CalciteUIIcons_Glyph_Trash}"
132132
ToolTipProperties.Text="Delete all geometries" />

src/MAUI/Maui.Samples/Samples/Geometry/EditGeometriesWithProgrammaticReticleTool/EditGeometriesWithProgrammaticReticleTool.xaml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
Clicked="DiscardButton_Click"
2121
HeightRequest="40"
2222
HorizontalOptions="Start"
23-
IsVisible="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}}"
23+
IsVisible="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}, x:DataType=esriUI:MapView}"
2424
Text="Cancel" />
2525
<Button x:Name="SettingsButton"
2626
Grid.Column="1"
@@ -37,8 +37,8 @@
3737
Clicked="SaveButton_Click"
3838
HeightRequest="40"
3939
HorizontalOptions="End"
40-
IsEnabled="{Binding GeometryEditor.CanUndo, Source={x:Reference MyMapView}}"
41-
IsVisible="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}}"
40+
IsEnabled="{Binding GeometryEditor.CanUndo, Source={x:Reference MyMapView}, x:DataType=esriUI:MapView}"
41+
IsVisible="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}, x:DataType=esriUI:MapView}"
4242
Text="Done" />
4343
</Grid>
4444
<esriUI:MapView x:Name="MyMapView"
@@ -67,7 +67,7 @@
6767
<Label Text="Allow vertex creation" VerticalOptions="Center" />
6868
<Switch x:Name="AllowVertexCreationSwitch" />
6969
</StackLayout>
70-
<StackLayout IsVisible="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}, Converter={StaticResource InvertedBoolConverter}}"
70+
<StackLayout IsVisible="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}, Converter={StaticResource InvertedBoolConverter}, x:DataType=esriUI:MapView}"
7171
Orientation="Horizontal"
7272
Spacing="10">
7373
<Label Text="Geometry type" VerticalOptions="Center" />
@@ -76,24 +76,27 @@
7676
<Button Grid.Row="2"
7777
Grid.Column="3"
7878
Clicked="UndoButton_Click"
79-
IsVisible="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}}"
79+
IsVisible="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}, x:DataType=esriUI:MapView}"
8080
Text="Undo">
8181
<Button.IsEnabled>
8282
<MultiBinding Converter="{StaticResource VariableMultiValueConverter}">
83-
<Binding Converter="{StaticResource IsNotNullConverter}"
83+
<Binding x:DataType="esriUI:MapView"
84+
Converter="{StaticResource IsNotNullConverter}"
8485
Path="GeometryEditor.PickedUpElement"
8586
Source="{x:Reference MyMapView}" />
86-
<Binding Path="GeometryEditor.CanUndo" Source="{x:Reference MyMapView}" />
87+
<Binding x:DataType="esriUI:MapView"
88+
Path="GeometryEditor.CanUndo"
89+
Source="{x:Reference MyMapView}" />
8790
</MultiBinding>
8891
</Button.IsEnabled>
8992
</Button>
9093
<Button Clicked="RedoButton_Click"
91-
IsEnabled="{Binding GeometryEditor.CanRedo, Source={x:Reference MyMapView}}"
92-
IsVisible="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}}"
94+
IsEnabled="{Binding GeometryEditor.CanRedo, Source={x:Reference MyMapView}, x:DataType=esriUI:MapView}"
95+
IsVisible="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}, x:DataType=esriUI:MapView}"
9396
Text="Redo" />
9497
<Button Clicked="DeleteSelectedButton_Click"
95-
IsEnabled="{Binding GeometryEditor.SelectedElement.CanDelete, Source={x:Reference MyMapView}, FallbackValue=False}"
96-
IsVisible="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}}"
98+
IsEnabled="{Binding GeometryEditor.SelectedElement.CanDelete, Source={x:Reference MyMapView}, FallbackValue=False, x:DataType=esriUI:MapView}"
99+
IsVisible="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}, x:DataType=esriUI:MapView}"
97100
Text="Delete" />
98101
<Button x:Name="ClosePopupButton"
99102
Clicked="ClosePopupButton_Clicked"

0 commit comments

Comments
 (0)