<Page
    x:Class="MapsSamples.EarthQuake"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:c1="using:C1.Xaml.Maps"
    xmlns:loc="using:MapsSamples"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">
    <UserControl.Resources>
        <c1:XElementConverter x:Key="xcnv" />
        <Style x:Key="style" TargetType="c1:C1VectorPlacemark">
            <Setter Property="Stroke" Value="#F6AAC9" />
            <Setter Property="StrokeThickness" Value="2" />
            <Setter Property="LabelPosition" Value="Right" />
            <Setter Property="LabelTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="2" />
                                <ColumnDefinition Width="5" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <Line X2="5" Grid.Column="1" VerticalAlignment="Center" Stroke="LightGray" StrokeThickness="2" />
                            <Border Background="#70ffffff" Grid.Column="2" Padding="2">
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock MaxWidth="300" TextWrapping="Wrap" Text="{Binding Converter={StaticResource xcnv},ConverterParameter=title}" />
                                    <TextBlock MaxWidth="150" TextWrapping="Wrap" Text="{Binding Converter={StaticResource xcnv},ConverterParameter=name}" />
                                </StackPanel>
                            </Border>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="Geometry" Value="M3,0 A 3,3 180 1 0 -3,0 A 3,3 180 1 0 3,0 Z" />
        </Style>
    </UserControl.Resources>
    <Grid>
        <Border>
            <Grid>
                <c1:C1Maps x:Name="maps" Zoom="2">
                    <c1:C1VectorLayer ItemStyle="{StaticResource style}" />
                </c1:C1Maps>
                <loc:MapTool Maps="{Binding ElementName=maps}" x:Name="mapTool"/>
            </Grid>
        </Border>
        <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>
