I am tryin to add rectangle to on to an image in wpf. Rectangle is drawn at MouseLeftButtonDown event.
Problem is I want to add this rectangle straight to the Grid (on to the image) without using a canvas.
How Can I do that? or
How can I avoid using a canvas?

<UserControl>
<Grid x:Name="LayoutRoot" 
        MouseLeftButtonDown= "OnMouseLeftButtonDown"
        MouseLeftButtonUp="OnMouseLeftButtonUp"
        MouseMove="OnMouseMove"
        Background="Transparent"
          >

    <Canvas x:Name="canvas"> 

         <Image Name="image" Source=".....\Penguins.jpg"/>        
         <Rectangle 
                      x:Name="selectionBox"
                       StrokeThickness="1"
                       Stroke="Black"
                       Visibility="Collapsed" 


                       /> 


    </Canvas>
</Grid>
</UserControl>

Thankx in advance

Hi jrosh,
What are you using? Blend or Visual Studio? You didnt join expression forum?
Following are some sources from where you can start studying

WPF==> WPF tutorials at kirupa
You can study silverlight at Microsoft .toolbox free video tutorials (.toolbox)
I hope this will help you :)

Are you student? Looking at your xaml above looks like you are using Visual Studio.
Why dont you put image inside the rectangle.
Sorry but I didnt understand your problem exactly. If this doesnt help please give more details :)

Thankx roc.ky . tutorials helped me a lot.

:) Post your solution to complete the thread with answer, if you have found it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.