-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
30 changed files
with
477 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,38 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:mauiMaps="clr-namespace:MauiMaps" | ||
x:Class="MauiMaps.MainPage"> | ||
<ContentPage | ||
x:Class="MauiMaps.MainPage" | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:mauiMaps="clr-namespace:MauiMaps" | ||
xmlns:models="clr-namespace:MauiMaps.Models" | ||
x:DataType="mauiMaps:MainPageViewModel"> | ||
|
||
<Grid RowDefinitions="*,*"> | ||
<Map x:Name="MyMap" Grid.Row="0"/> | ||
<Map x:Name="MyMap2" ItemsSource="{Binding Sites}" Grid.Row="1"> | ||
<Map.ItemTemplate> | ||
<DataTemplate x:DataType="{x:Type mauiMaps:Site}"> | ||
<Grid> | ||
<Map | ||
x:Name="MyMap" | ||
IsShowingUser="True" | ||
ItemsSource="{Binding LocationPins}"> | ||
<Map.ItemTemplate> | ||
<DataTemplate x:DataType="{x:Type models:LocationPin}"> | ||
<mauiMaps:CustomPin | ||
Location="{Binding .Location}" | ||
Address="{Binding Address}" | ||
Label="{Binding Description}" | ||
ImageSource="{Binding ImageSource}" | ||
Type="Place"/> | ||
Location="{Binding Location}" | ||
Address="{Binding Address}" | ||
Label="{Binding Description}" | ||
ImageSource="{Binding ImageSource}" | ||
Type="Place"/> | ||
</DataTemplate> | ||
</Map.ItemTemplate> | ||
</Map> | ||
</Grid> | ||
</Map.ItemTemplate> | ||
</Map> | ||
<Button | ||
Margin="0,0,0,10" | ||
BackgroundColor="White" | ||
Command="{Binding AddCommand}" | ||
FontAttributes="Bold" | ||
HeightRequest="40" | ||
HorizontalOptions="Center" | ||
Text="Add new pin" | ||
TextColor="Red" | ||
VerticalOptions="End" /> | ||
</Grid> | ||
|
||
</ContentPage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace MauiMaps; | ||
|
||
using System.Collections.ObjectModel; | ||
using AutoFixture; | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using CommunityToolkit.Mvvm.Input; | ||
using Models; | ||
|
||
public partial class MainPageViewModel : ObservableObject | ||
{ | ||
private readonly IFixture fixture; | ||
|
||
public MainPageViewModel(IFixture fixture) | ||
{ | ||
this.fixture = fixture; | ||
} | ||
|
||
[RelayCommand] | ||
private void Add() | ||
{ | ||
var newLocation = fixture.Build<LocationPin>() | ||
.With(x => x.ImageSource, ImageSource.FromUri(new Uri($"https://picsum.photos/{Random.Shared.Next(40, 60)}"))) | ||
.With(x => x.Location, new Location(Random.Shared.Next(5, 15), Random.Shared.Next(5, 15))) | ||
.Create(); | ||
LocationPins.Add(newLocation); | ||
} | ||
|
||
public ObservableCollection<LocationPin> LocationPins { get; } = new(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace MauiMaps.Models; | ||
|
||
public class LocationPin | ||
{ | ||
public string? Description { get; set; } | ||
public string? Address { get; set; } | ||
public Location? Location { get; set; } | ||
public ImageSource? ImageSource { get; set; } | ||
} |
Oops, something went wrong.