Skip to content
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
Binary file added GettingStarted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions MapsGettingStarted_Sample/MapsGettingStarted_Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<AssemblyName>MapsGettingStarted_Sample</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.16299.0</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.26100.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
Expand Down Expand Up @@ -158,7 +158,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.7</Version>
<Version>6.2.14</Version>
</PackageReference>
<PackageReference Include="Syncfusion.SfMaps.UWP">
<Version>*</Version>
Expand Down
97 changes: 70 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,85 @@
# Getting Started with UWP Map (SfMaps)

This repository contains sample to getting started with the [Syncfusion UWP Map](https://help.syncfusion.com/uwp/map/getting-started) control.
This sample demonstrates how to create a UWP Map using the Syncfusion `SfMap` control.

## Syncfusion controls
## Prerequisites

This project used the following Syncfusion control(s):
* [SfMaps](https://www.syncfusion.com/uwp-ui-controls/map)
- Visual Studio 2022 or later
- Windows 10 SDK (10.0.16299.0 or later)
- [Syncfusion.SfMaps.UWP](https://www.nuget.org/packages/Syncfusion.SfMaps.UWP) NuGet package (latest)

## Requirements to run the sample
## Adding Assembly Reference

* [Visual Studio](https://visualstudio.microsoft.com/downloads/)
* Windows 10 SDK
### Option 1: Via NuGet Package Manager

Refer to the following link for more details - [System Requirements](https://help.syncfusion.com/uwp/system-requirements)
1. Right-click on the project in **Solution Explorer** and select **Manage NuGet Packages**.
2. Search for `Syncfusion.SfMaps.UWP` and install it.

## How to run the sample
### Option 2: Via Extension Reference

1. Clone the sample and open it in Visual Studio.
1. Open the **Add Reference** window from your project.
2. Choose **Windows > Extensions > Syncfusion Controls for UWP XAML**.

*Note: If you download the sample using the "Download ZIP" option, right-click it, select Properties, and then select Unblock.*

2. Register your license key in the App.cs file as demonstrated in the following code.
## Adding Namespace

public App()
{
//Register Syncfusion license
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");
After adding the reference, include the following namespace in your `MainPage.xaml`:

this.InitializeComponent();
this.Suspending += OnSuspending;
}

Refer to this [link](https://help.syncfusion.com/uwp/licensing/overview) for more details.

3. Clean and build the application.
```xml
xmlns:syncfusion="using:Syncfusion.UI.Xaml.Maps"
```

4. Run the application.
## Initializing the Map (XAML)

## License
In `MainPage.xaml`, initialize `SfMap` by adding a `ShapeFileLayer` and setting the `Uri` property to point to your shape file:

Syncfusion has no liability for any damage or consequence that may arise by using or viewing the samples. The samples are for demonstrative purposes, and if you choose to use or access the samples, you agree to not hold Syncfusion liable, in any form, for any damage that is related to use, for accessing, or viewing the samples. By accessing, viewing, or seeing the samples, you acknowledge and agree Syncfusion’s samples will not allow you seek injunctive relief in any form for any claim related to the sample. If you do not agree to this, do not view, access, utilize, or otherwise do anything with Syncfusion’s samples.
```xml
<Page
x:Class="MapsGettingStarted_Sample.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MapsGettingStarted_Sample"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:syncfusion="using:Syncfusion.UI.Xaml.Maps"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Name="mainGrid">
<syncfusion:SfMap>
<syncfusion:SfMap.Layers>
<syncfusion:ShapeFileLayer Uri="MapsGettingStarted_Sample.Assets.ShapeFiles.world1.shp">
</syncfusion:ShapeFileLayer>
</syncfusion:SfMap.Layers>
</syncfusion:SfMap>
</Grid>
</Page>
```

## Initializing the Map (Code-Behind)

Alternatively, you can create the map entirely in C# code-behind:

```csharp
using Syncfusion.UI.Xaml.Maps;

// Initializing the map
SfMap syncMap = new SfMap();

// Creating and configuring the shape file layer
ShapeFileLayer layer = new ShapeFileLayer();
layer.Uri = "MapsGettingStarted_Sample.Assets.ShapeFiles.world1.shp";

// Adding the layer to the map
syncMap.Layers.Add(layer);

// Adding map to the Grid
mainGrid.Children.Add(syncMap);
```

![Maps getting started image](GettingStarted.png)

## Reference

- [Syncfusion UWP Maps Getting Started Documentation](https://help.syncfusion.com/uwp/map/getting-started)
- [Syncfusion UWP Maps Product Page](https://www.syncfusion.com/uwp-ui-controls/map)
- [Shapefile Technical Description](http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf)
Loading