title: ItemsControl inside existing Canvas
body: <p>I am trying to accomplish the following.</p>
  
  <p>1) Have a canvas control on my page, with a background image that is scalable and pannable.  This works OK with what I have.
  2) Display a set of controls within the canvas.  This is envisaged to be similar to the way the Bing homepage displays hotspots on the image shown there.  The controls need to move around on the canvas as the image is panned/zoomed.</p>
  
  <p>I've tried the following</p>
  
  <pre><code>    &lt;Canvas Name="PanoCanvas" &gt;
          &lt;Canvas.Background&gt;
              &lt;ImageBrush x:Name="PanoImage" ImageSource="/Images/OtherImages/PanoBackound.jpg" Stretch="None" /&gt;
          &lt;/Canvas.Background&gt;
          &lt;ItemsControl Name="POIPresenter"&gt;
              &lt;ItemsControl.ItemTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;uc:PointOfInterest /&gt;
                  &lt;/DataTemplate&gt;
              &lt;/ItemsControl.ItemTemplate&gt;
              &lt;ItemsControl.ItemsPanel&gt;
                  &lt;ItemsPanelTemplate&gt;
                      &lt;Canvas /&gt;
                  &lt;/ItemsPanelTemplate&gt;
              &lt;/ItemsControl.ItemsPanel&gt;
              &lt;ItemsControl.ItemContainerStyle&gt;
                  &lt;Style TargetType="ContentPresenter"&gt;
                      &lt;Setter Property="Canvas.Top" Value="{Binding TopPosition}" /&gt;
                      &lt;Setter Property="Canvas.Left" Value="{Binding LeftPosition}" /&gt;
                  &lt;/Style&gt;
              &lt;/ItemsControl.ItemContainerStyle&gt;
          &lt;/ItemsControl&gt;
      &lt;/Canvas&gt;
  </code></pre>
  
  <p>and set the ItemsSource of POIPresenter in code behind, but the user controls are displaying on top of one another on the left (at 0,0).</p>
  
  <p>I have tried moving the canvas declarations inside the ItemsPanelTemplate, but then my declarations to set the scale/centre of the image do not work - they can't find the PanoCanvas control.</p>
  
  <p>Can anyone point out the painfully obvious thing that I'm doing wring here, please?</p>
  
  <p>Thanks in advance.</p>