<Page
    x:Class="MapsSamples.Factories"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:MapsSamples"
    xmlns:c1="using:C1.Xaml.Maps"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">
    <Page.Resources>
        <DataTemplate x:Name="factoryTemplate" x:Key="factoryTemplate">
            <Grid Width="60" Height="60" c1:C1MapCanvas.Pinpoint="30, 30" 
                  c1:C1MapCanvas.LongLat="{Binding Position}">
                <Image Source="Assets/factory.png" />
                <Grid Background="Transparent" ToolTipService.ToolTip="{Binding Name}" />
            </Grid>
        </DataTemplate>
        <DataTemplate x:Name="officeTemplate" x:Key="officeTemplate">
            <Grid Width="60" Height="60" c1:C1MapCanvas.Pinpoint="30, 30"
                  c1:C1MapCanvas.LongLat="{Binding Position}">
                <Image Source="../Assets/office.png" />
                <Grid Background="Transparent" ToolTipService.ToolTip="{Binding Name}" />
                <Border HorizontalAlignment="Right" VerticalAlignment="Top" Background="#F6AAC9" CornerRadius="12"
                        Margin="0, -10, 0, 0" Width="25" Height="25" BorderBrush="#F07E6E" BorderThickness="1">
                    <TextBlock Text="{Binding Stores}" Foreground="White" VerticalAlignment="Center" 
                               HorizontalAlignment="Center"/>
                </Border>
            </Grid>
        </DataTemplate>
        <DataTemplate x:Name="storeTemplate" x:Key="storeTemplate">
            <Grid Width="60" Height="60" c1:C1MapCanvas.Pinpoint="30, 30" 
                  c1:C1MapCanvas.LongLat="{Binding Position}">
                <Image Source="../Assets/store.png" />
                <Grid Background="Transparent" ToolTipService.ToolTip="{Binding Name}" />
            </Grid>
        </DataTemplate>
    </Page.Resources>
    
    <Grid>
        <c1:C1Maps x:Name="maps" Zoom="2" Center="-45, 30">
            <c1:C1Maps.Source>
                <c1:VirtualEarthHybridSource></c1:VirtualEarthHybridSource>
            </c1:C1Maps.Source>
        </c1:C1Maps>
        <local:MapTool Maps="{Binding ElementName=maps}" x:Name="mapTool"></local:MapTool>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup>
                <VisualState x:Name="NarrowLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="0"></AdaptiveTrigger>
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="mapTool.Visibility" Value="Collapsed"></Setter>
                    </VisualState.Setters>
                </VisualState>
                <VisualState x:Name="WideLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="540"></AdaptiveTrigger>
                    </VisualState.StateTriggers>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</Page>
