Added WinUI Sample Application

This commit is contained in:
Clemens 2021-07-01 22:07:46 +02:00
parent f8b0bcbeb1
commit e138cb83ab
24 changed files with 421 additions and 99 deletions

9
.editorconfig Normal file
View file

@ -0,0 +1,9 @@
[*.cs]
csharp_style_var_when_type_is_apparent=true:silent
csharp_style_var_for_built_in_types=true:silent
csharp_style_var_elsewhere=true:silent
csharp_prefer_simple_using_statement=false:suggestion
csharp_style_expression_bodied_properties=false:silent
csharp_style_expression_bodied_indexers=false:silent
csharp_style_expression_bodied_accessors=false:silent
csharp_style_expression_bodied_lambdas=false:silent

View file

@ -15,90 +15,83 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapControl.WPF", "MapContro
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfApplication", "SampleApps\WpfApplication\WpfApplication.csproj", "{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfApplication", "SampleApps\WpfApplication\WpfApplication.csproj", "{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapControl.WinUI", "MapControl\WinUI\MapControl.WinUI.csproj", "{92894476-02E1-47CB-936E-4154023456F0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{47E434EE-BB49-4171-A24A-8FFF55EE0C2F}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinUiApp", "SampleApps\WinUiApp\WinUiApp.csproj", "{D52D7ECE-9979-4287-9118-93DE23DD8F69}"
EndProject
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "WinUiApp (Package)", "SampleApps\WinUiApp (Package)\WinUiApp (Package).wapproj", "{2DB6959F-1768-495C-8EED-4830EF185584}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|x64 = Release|x64 Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.ActiveCfg = Debug|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.ActiveCfg = Debug|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.Build.0 = Debug|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.Build.0 = Debug|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.Deploy.0 = Debug|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.Deploy.0 = Debug|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|ARM.ActiveCfg = Debug|ARM
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|ARM.Build.0 = Debug|ARM
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|ARM.Deploy.0 = Debug|ARM
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x64.ActiveCfg = Debug|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x64.ActiveCfg = Debug|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x64.Build.0 = Debug|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x64.Build.0 = Debug|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x64.Deploy.0 = Debug|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x64.Deploy.0 = Debug|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x86.ActiveCfg = Debug|x86
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x86.Build.0 = Debug|x86
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x86.Deploy.0 = Debug|x86
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|Any CPU.ActiveCfg = Release|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|Any CPU.ActiveCfg = Release|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|Any CPU.Build.0 = Release|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|Any CPU.Build.0 = Release|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|Any CPU.Deploy.0 = Release|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|Any CPU.Deploy.0 = Release|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|ARM.ActiveCfg = Release|ARM
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|ARM.Build.0 = Release|ARM
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|ARM.Deploy.0 = Release|ARM
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x64.ActiveCfg = Release|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x64.ActiveCfg = Release|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x64.Build.0 = Release|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x64.Build.0 = Release|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x64.Deploy.0 = Release|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x64.Deploy.0 = Release|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x86.ActiveCfg = Release|x86
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x86.Build.0 = Release|x86
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x86.Deploy.0 = Release|x86
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|Any CPU.Build.0 = Debug|Any CPU {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|ARM.ActiveCfg = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|ARM.Build.0 = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|x64.ActiveCfg = Debug|Any CPU {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|x64.ActiveCfg = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|x64.Build.0 = Debug|Any CPU {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|x64.Build.0 = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|x86.ActiveCfg = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|x86.Build.0 = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|Any CPU.ActiveCfg = Release|Any CPU {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|Any CPU.Build.0 = Release|Any CPU {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|Any CPU.Build.0 = Release|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|ARM.ActiveCfg = Release|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|ARM.Build.0 = Release|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|x64.ActiveCfg = Release|Any CPU {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|x64.ActiveCfg = Release|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|x64.Build.0 = Release|Any CPU {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|x64.Build.0 = Release|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|x86.ActiveCfg = Release|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|x86.Build.0 = Release|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|Any CPU.Build.0 = Debug|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|ARM.ActiveCfg = Debug|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|ARM.Build.0 = Debug|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|x64.ActiveCfg = Debug|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|x64.ActiveCfg = Debug|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|x64.Build.0 = Debug|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|x64.Build.0 = Debug|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|x86.ActiveCfg = Debug|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|x86.Build.0 = Debug|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|Any CPU.ActiveCfg = Release|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|Any CPU.Build.0 = Release|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|Any CPU.Build.0 = Release|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|ARM.ActiveCfg = Release|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|ARM.Build.0 = Release|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|x64.ActiveCfg = Release|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|x64.ActiveCfg = Release|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|x64.Build.0 = Release|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|x64.Build.0 = Release|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|x86.ActiveCfg = Release|Any CPU
{62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|x86.Build.0 = Release|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|Any CPU.Build.0 = Debug|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|ARM.ActiveCfg = Debug|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|ARM.Build.0 = Debug|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|x64.ActiveCfg = Debug|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|x64.ActiveCfg = Debug|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|x64.Build.0 = Debug|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|x64.Build.0 = Debug|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|x86.ActiveCfg = Debug|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|x86.Build.0 = Debug|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|Any CPU.ActiveCfg = Release|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|Any CPU.Build.0 = Release|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|Any CPU.Build.0 = Release|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|ARM.ActiveCfg = Release|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|ARM.Build.0 = Release|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|x64.ActiveCfg = Release|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|x64.ActiveCfg = Release|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|x64.Build.0 = Release|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|x64.Build.0 = Release|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|x86.ActiveCfg = Release|Any CPU {92894476-02E1-47CB-936E-4154023456F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|x86.Build.0 = Release|Any CPU {92894476-02E1-47CB-936E-4154023456F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92894476-02E1-47CB-936E-4154023456F0}.Debug|x64.ActiveCfg = Debug|Any CPU
{92894476-02E1-47CB-936E-4154023456F0}.Debug|x64.Build.0 = Debug|Any CPU
{92894476-02E1-47CB-936E-4154023456F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92894476-02E1-47CB-936E-4154023456F0}.Release|Any CPU.Build.0 = Release|Any CPU
{92894476-02E1-47CB-936E-4154023456F0}.Release|x64.ActiveCfg = Release|Any CPU
{92894476-02E1-47CB-936E-4154023456F0}.Release|x64.Build.0 = Release|Any CPU
{D52D7ECE-9979-4287-9118-93DE23DD8F69}.Debug|Any CPU.ActiveCfg = Debug|x64
{D52D7ECE-9979-4287-9118-93DE23DD8F69}.Debug|x64.ActiveCfg = Debug|x64
{D52D7ECE-9979-4287-9118-93DE23DD8F69}.Debug|x64.Build.0 = Debug|x64
{D52D7ECE-9979-4287-9118-93DE23DD8F69}.Release|Any CPU.ActiveCfg = Release|x64
{D52D7ECE-9979-4287-9118-93DE23DD8F69}.Release|x64.ActiveCfg = Release|x64
{D52D7ECE-9979-4287-9118-93DE23DD8F69}.Release|x64.Build.0 = Release|x64
{2DB6959F-1768-495C-8EED-4830EF185584}.Debug|Any CPU.ActiveCfg = Debug|x64
{2DB6959F-1768-495C-8EED-4830EF185584}.Debug|x64.ActiveCfg = Debug|x64
{2DB6959F-1768-495C-8EED-4830EF185584}.Debug|x64.Build.0 = Debug|x64
{2DB6959F-1768-495C-8EED-4830EF185584}.Debug|x64.Deploy.0 = Debug|x64
{2DB6959F-1768-495C-8EED-4830EF185584}.Release|Any CPU.ActiveCfg = Release|x64
{2DB6959F-1768-495C-8EED-4830EF185584}.Release|x64.ActiveCfg = Release|x64
{2DB6959F-1768-495C-8EED-4830EF185584}.Release|x64.Build.0 = Release|x64
{2DB6959F-1768-495C-8EED-4830EF185584}.Release|x64.Deploy.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -108,6 +101,9 @@ Global
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344} = {52AECE49-F314-4F76-98F2-FA800F07824B} {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344} = {52AECE49-F314-4F76-98F2-FA800F07824B}
{62F1726B-3144-49F4-8BCC-94160A3B2186} = {52AECE49-F314-4F76-98F2-FA800F07824B} {62F1726B-3144-49F4-8BCC-94160A3B2186} = {52AECE49-F314-4F76-98F2-FA800F07824B}
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E} = {8F2103C2-78AF-4810-8FB9-67572F50C8FC} {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E} = {8F2103C2-78AF-4810-8FB9-67572F50C8FC}
{92894476-02E1-47CB-936E-4154023456F0} = {52AECE49-F314-4F76-98F2-FA800F07824B}
{D52D7ECE-9979-4287-9118-93DE23DD8F69} = {8F2103C2-78AF-4810-8FB9-67572F50C8FC}
{2DB6959F-1768-495C-8EED-4830EF185584} = {8F2103C2-78AF-4810-8FB9-67572F50C8FC}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {458346DD-B23F-4FDC-8F9D-A10F1882A4DB} SolutionGuid = {458346DD-B23F-4FDC-8F9D-A10F1882A4DB}

View file

@ -2,8 +2,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Globalization; #if WINUI
#if WINDOWS_UWP using Microsoft.UI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Media;
#elif WINDOWS_UWP
using Windows.UI; using Windows.UI;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Media;
@ -123,10 +126,6 @@ namespace ViewModel
ServiceUri = new Uri("http://ows.terrestris.de/osm/service") ServiceUri = new Uri("http://ows.terrestris.de/osm/service")
} }
}, },
{
"SevenCs ChartServer WMS",
new ChartServerLayer()
}
}; };
private string currentMapLayerName = "OpenStreetMap"; private string currentMapLayerName = "OpenStreetMap";
@ -161,7 +160,6 @@ namespace ViewModel
"TopPlusOpen WMTS", "TopPlusOpen WMTS",
"TopPlusOpen WMS", "TopPlusOpen WMS",
"OpenStreetMap WMS", "OpenStreetMap WMS",
"SevenCs ChartServer WMS",
}; };
public MapLayers() public MapLayers()
@ -179,28 +177,4 @@ namespace ViewModel
} }
} }
} }
public class ChartServerLayer : WmsImageLayer
{
public ChartServerLayer()
{
Description = "© [SevenCs GmbH](http://www.sevencs.com)";
ServiceUri = new Uri("http://wms.sevencs.com");
Layers = "ENC";
MaxBoundingBoxWidth = 360;
}
protected override string GetCrsParam(MapProjection projection)
{
switch (projection.CrsId)
{
case "AUTO2:97001":
return string.Format(CultureInfo.InvariantCulture, "CRS=AUTO2:7CS01,1,{0},{1}", projection.Center.Longitude, projection.Center.Latitude);
case "AUTO2:97002":
return string.Format(CultureInfo.InvariantCulture, "CRS=AUTO2:7CS02,1,{0},{1}", projection.Center.Longitude, projection.Center.Latitude);
default:
return base.GetCrsParam(projection);
}
}
}
} }

View file

@ -2,8 +2,7 @@
x:Class="UniversalApp.MainPage" x:Class="UniversalApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:map="using:MapControl" xmlns:map="using:MapControl">
xmlns:local="using:UniversalApp">
<Page.Resources> <Page.Resources>
<DataTemplate x:Key="PolylineItemTemplate"> <DataTemplate x:Key="PolylineItemTemplate">
@ -101,6 +100,7 @@
<RowDefinition/> <RowDefinition/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<map:Map x:Name="map" MinZoomLevel="2" MaxZoomLevel="20" ZoomLevel="11" ManipulationMode="All" <map:Map x:Name="map" MinZoomLevel="2" MaxZoomLevel="20" ZoomLevel="11" ManipulationMode="All"
Center="{x:Bind ViewModel.MapCenter, Mode=TwoWay}" Center="{x:Bind ViewModel.MapCenter, Mode=TwoWay}"
MapLayer="{x:Bind ViewModel.MapLayers.CurrentMapLayer, Mode=OneWay}" MapLayer="{x:Bind ViewModel.MapLayers.CurrentMapLayer, Mode=OneWay}"

View file

@ -47,32 +47,6 @@
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain> <UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
<EnableGatekeeperAnalysis>false</EnableGatekeeperAnalysis> <EnableGatekeeperAnalysis>false</EnableGatekeeperAnalysis>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
<EnableGatekeeperAnalysis>false</EnableGatekeeperAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>none</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<EnableGatekeeperAnalysis>false</EnableGatekeeperAnalysis>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\Shared\MapLayers.cs"> <Compile Include="..\Shared\MapLayers.cs">
<Link>MapLayers.cs</Link> <Link>MapLayers.cs</Link>

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">
<Identity
Name="84f8e6f4-81bf-4eea-81ad-898a437057ae"
Publisher="CN=Clemens"
Version="1.0.0.0" />
<Properties>
<DisplayName>WinUiApp (Package)</DisplayName>
<PublisherDisplayName>Clemens</PublisherDisplayName>
<Logo>Images\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="WinUiApp (Package)"
Description="WinUiApp (Package)"
BackgroundColor="transparent"
Square150x150Logo="Images\Square150x150Logo.png"
Square44x44Logo="Images\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" />
<uap:SplashScreen Image="Images\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '15.0'">
<VisualStudioVersion>15.0</VisualStudioVersion>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup>
<WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
<PathToXAMLWinRTImplementations>WinUiApp\</PathToXAMLWinRTImplementations>
</PropertyGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
<PropertyGroup>
<ProjectGuid>2db6959f-1768-495c-8eed-4830ef185584</ProjectGuid>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<AssetTargetFallback>net5.0-windows$(TargetPlatformVersion);$(AssetTargetFallback)</AssetTargetFallback>
<DefaultLanguage>en-US</DefaultLanguage>
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
<EntryPointProjectUniqueName>..\WinUiApp\WinUiApp.csproj</EntryPointProjectUniqueName>
</PropertyGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="Images\SplashScreen.scale-200.png" />
<Content Include="Images\LockScreenLogo.scale-200.png" />
<Content Include="Images\Square150x150Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Images\StoreLogo.png" />
<Content Include="Images\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WinUiApp\WinUiApp.csproj">
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
<PublishProfile>Properties\PublishProfiles\win10-$(Platform).pubxml</PublishProfile>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ProjectReunion" Version="[0.8.0]">
<IncludeAssets>build</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="[0.8.0]">
<IncludeAssets>build</IncludeAssets>
</PackageReference>
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
</Project>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebuggerFlavor>AppHostLocalDebugger</DebuggerFlavor>
<RemoteDebugEnabled>False</RemoteDebugEnabled>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,13 @@
<Application
x:Class="WinUiApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WinUiApp">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

View file

@ -0,0 +1,51 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Microsoft.UI.Xaml.Shapes;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace WinUiApp
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
m_window = new MainWindow();
m_window.Activate();
}
private Window m_window;
}
}

View file

@ -0,0 +1,41 @@
<Window
x:Class="WinUiApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:map="using:MapControl">
<Grid x:Name="root">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<map:Map x:Name="map" ZoomLevel="11" MaxZoomLevel="21" MouseWheelZoomDelta="1"
Center="{Binding MapCenter}"
MapLayer="{Binding MapLayers.CurrentMapLayer}">
<map:MapGraticule x:Name="graticule" Opacity="0.6"
Visibility="{Binding IsChecked, ElementName=graticuleCheckBox}"/>
</map:Map>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<CheckBox x:Name="graticuleCheckBox"
VerticalAlignment="Center" Content="Graticule"/>
<CheckBox VerticalAlignment="Center" Content="Seamarks"
Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/>
<ComboBox Width="250" VerticalAlignment="Center" Margin="5"
ItemsSource="{Binding MapLayers.MapLayerNames}"
SelectedItem="{Binding MapLayers.CurrentMapLayerName, Mode=TwoWay}"/>
</StackPanel>
</Grid>
</Grid>
</Window>

View file

@ -0,0 +1,62 @@
using MapControl;
using MapControl.Caching;
using Microsoft.UI.Xaml;
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using ViewModel;
namespace WinUiApp
{
public sealed partial class MainWindow : Window
{
private readonly MapViewModel viewModel = new();
static MainWindow()
{
try
{
ImageLoader.HttpClient.DefaultRequestHeaders.Add("User-Agent", "XAML Map Control Test Application");
var appData = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl");
TileImageLoader.Cache = new ImageFileCache(Path.Combine(appData, "TileCache"));
BingMapsTileLayer.ApiKey = File.ReadAllText(Path.Combine(appData, "BingMapsApiKey.txt"))?.Trim();
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
public MainWindow()
{
InitializeComponent();
Title = "XAML Map Control - WinUI Sample Application";
root.DataContext = viewModel;
if (TileImageLoader.Cache is ImageFileCache cache)
{
Activated += async (s, e) =>
{
await Task.Delay(2000);
await cache.Clean();
};
}
}
private void SeamarksChecked(object sender, RoutedEventArgs e)
{
map.Children.Insert(map.Children.IndexOf(graticule), viewModel.MapLayers.SeamarksLayer);
}
private void SeamarksUnchecked(object sender, RoutedEventArgs e)
{
map.Children.Remove(viewModel.MapLayers.SeamarksLayer);
}
}
}

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x64</Platform>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun>True</PublishReadyToRun>
<!--
See https://github.com/microsoft/CsWinRT/issues/373
<PublishTrimmed>True</PublishTrimmed>
-->
</PropertyGroup>
</Project>

View file

@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows10.0.19041</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>WinUiApp</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x64</Platforms>
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
<UseWinUI>true</UseWinUI>
<Product>XAML Map Control</Product>
<Version>6.0.0</Version>
<Description>XAML Map Control WinUI Sample Application</Description>
<Authors>Clemens Fischer</Authors>
<Copyright>Copyright © 2021 Clemens Fischer</Copyright>
<AnalysisLevel>none</AnalysisLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DefineConstants>WINUI</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DefineConstants>WINUI</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Shared\MapLayers.cs" Link="MapLayers.cs" />
<Compile Include="..\Shared\MapViewModel.cs" Link="MapViewModel.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ProjectReunion" Version="0.8.0" />
<PackageReference Include="Microsoft.ProjectReunion.Foundation" Version="0.8.0" />
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="0.8.0" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MapControl\WinUI\MapControl.WinUI.csproj" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RunAnalyzersDuringLiveAnalysis>true</RunAnalyzersDuringLiveAnalysis>
</PropertyGroup>
<ItemGroup>
<None Update="App.xaml">
<SubType>Designer</SubType>
</None>
<None Update="MainWindow.xaml">
<SubType>Designer</SubType>
</None>
</ItemGroup>
</Project>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="WinUiApp.app"/>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<!-- The combination of below two tags have the following effect:
1) Per-Monitor for >= Windows 10 Anniversary Update
2) System < Windows 10 Anniversary Update
-->
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
</windowsSettings>
</application>
</assembly>