tags:

views:

230

answers:

2

Hi,

I started to make some thing in WPF and I have a question. I think the answer might be easy and even obvious, but somehow...

I have two controls on a form enclosed by a grid. I want two position the second control above the first one (it's transparent). Coming from WinForms development that isn't that hard, so it won't be in WPF. But I don't get the point...

Sascha

+1  A: 

If I am getting you correctly , just put the control in the reverse order inside the Grid. The order determines the Z-Index of the control

  <Grid>
    <c:ControlFirst/>
    <c:ControlSecond/>        
  </Grid>
Jobi Joy
+3  A: 

Either the Grid and Canvas controls would do what you wanted.

For most cases I'd recommend using the Grid to overlay elements, as you can also control how they resize easily. They'll stack in the order you define them (last defined at the top).

Try something like this:

<Grid>
    <Rectangle Fill="Blue"/>
    <Ellipse Fill="Red"/>
</Grid>

BTW - learning XAML is much easier to do in an interactive tool like Kaxaml.

Drew Noakes
That functions well for rectangle and ellipse. The control to be overlayed would be a webbrowser control. For this I replaced Rectangle through Webbrowser with the result that the ellipse isn't shown anymore.
Sascha
Got it with a browser running
Sascha
Glad it's working for you. I seriously recommend tinkering with Kaxaml to learn the ins and outs of WPF.
Drew Noakes