View Single Post
Old 07-18-2008   #6 (permalink)
JFlorero


 
 

Re: Adorner Layer Z order on WPF

Mark,

It doesn't work. The adorner still goes to the UserControl's adornerLayer.
It seems to make sense because the adorner is adorning the UnserControl and
not the Canvas.

Even if this had worked, do you think that by changing the order in the
adorner collection would change also the z order of the adorner? Do you know
if this is documented somewhere?

Thanks,

Jimmy

"Mark Salsbery [MVP]" wrote:
Quote:

> "JFlorero" <JFlorero@xxxxxx> wrote in message
> news:2A2E65F9-9D3F-4FFA-97DB-3C86E59EB043@xxxxxx
Quote:

> >
> > AdornerLayer MyAdornerLayer = AdornerLayer.GetAdornerLayer(MyUserControl);
> > MyAdornerLayer.Add(MyAdorner);
> >
> > MyCanvas.Children.Add(MyUserControl);
>
>
>
> What if you use a common adornerlayer from the parent canvas the controls,
> something like:
>
> /////////////////////////////////////////////////////////
> AdornerLayer MyAdornerLayer = AdornerLayer.GetAdornerLayer(myCanvas);
>
> // do for each of the canvas' child controls
> MyAdornerLayer.Add(new someadorner(MyUserControl));
> /////////////////////////////////////////////////////////
>
> Mark
>
> --
> Mark Salsbery
> Microsoft MVP - Visual C++
>
>
Quote:

> >
> >
> > Jimmy.
> >
> >
> > "Mark Salsbery [MVP]" wrote:
> >
Quote:

> >> "JFlorero" <JFlorero@xxxxxx> wrote in message
> >> news:2FDA9A8F-8AD2-4A7E-B080-D1B405485259@xxxxxx
> >> > Thanks for your replay Mark.
> >> >
> >> > This is my problem:
> >> > I have a Canvas that has many UserControls. Each UserControl has an
> >> > Adorner.
> >> > When the user controls are displayed, I can change the z-order of a
> >> > Usercontrol when the user clicks on it. The problem is that its Adorner
> >> > remains on the original z-order.
> >> > I tried to use your suggestion but it doesn’t work because I would need
> >> > to
> >> > get the array of all the adorners in the Canvas.
> >> > This is what I did:
> >> > AdornerLayer myAdornerLayer = AdornerLayer.GetAdornerLayer(myCanvas);
> >> > myAdornerLayer.GetAdorners(myCanvas);
> >> > This returns null all the time which makes scene because Each user
> >> > control
> >> > has its own adorner layer I guess. So the question would be how to
> >> > change
> >> > the
> >> > adorners z-order in relation to the parent container.
> >> >
> >>
> >>
> >> How are you adding the adorners?
> >>
> >> Mark
> >>
> >> --
> >> Mark Salsbery
> >> Microsoft MVP - Visual C++
> >>
> >>
> >> >
> >> > "Mark Salsbery [MVP]" wrote:
> >> >
> >> >> What about changing the order of the items in the array returned by
> >> >> AdornerLayer.GetAdorners()?
> >> >>
> >> >> Mark
> >> >>
> >> >> --
> >> >> Mark Salsbery
> >> >> Microsoft MVP - Visual C++
> >> >>
> >> >>
> >> >> "JFlorero" <JFlorero@xxxxxx> wrote in message
> >> >> news:2461EDB7-3EA1-409E-90F2-67FF4059F100@xxxxxx
> >> >> > Does anybody know how to change the Z order of adorners in the
> >> >> > AdornerLayer
> >> >> > of a Canvas? I can change the Z order of child UIElements but I
> >> >> > cannot
> >> >> > find a
> >> >> > way to change the z order of the adorners.
> >> >> >
> >> >> >
My System SpecsSystem Spec