<UserControl x:Class="ChartSamples.AddRemoveMarkers"
    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"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400"
    xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml"
             >
  <UserControl.Resources>
    <DataTemplate x:Key="marker">
      <c1:ChartPanelObject x:Name="obj" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch"
                           HorizontalAlignment="Center">
        <Grid>
          <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
          </Grid.RowDefinitions>
          <Border BorderBrush="DarkRed" BorderThickness="1" Background="#30ff0000" CornerRadius="3">
            <Grid>
              <TextBlock Margin="2,2,18,2" Text="{Binding ElementName=obj,Path=DataPoint.X,StringFormat='x={0:0.0}'}" />
              <Button Width="16" Height="16" Tag="{Binding ElementName=obj}" HorizontalAlignment="Right" VerticalAlignment="Center" Click="Button_Click">
                <Image Source="/ChartSamples;component/Resources/delete.png" />
              </Button>
            </Grid>
          </Border>
          <Rectangle Width="3" Grid.Row="1" Fill="Red" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
        </Grid>
      </c1:ChartPanelObject>
    </DataTemplate>
  </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
    <Grid.RowDefinitions>
      <RowDefinition />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
      <c1:C1Chart x:Name="chart" />
    <StackPanel Grid.Row="1" Orientation="Horizontal">
      <TextBlock Text="Click on the plot to create marker" />
    </StackPanel>
  </Grid>
</UserControl>
