Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista Tutorial - Adorner Layer Z order on WPF

 
 
Old 07-16-2008   #1 (permalink)
JFlorero
Guest


 
 

Adorner Layer Z order on WPF

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
Old 07-16-2008   #2 (permalink)
Mark Salsbery [MVP]
Guest


 
 

Re: Adorner Layer Z order on WPF

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
Quote:

> 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
Old 07-17-2008   #3 (permalink)
JFlorero
Guest


 
 

Re: Adorner Layer Z order on WPF

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.


"Mark Salsbery [MVP]" wrote:
Quote:

> 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
Quote:

> > 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
Old 07-18-2008   #4 (permalink)
Mark Salsbery [MVP]
Guest


 
 

Re: Adorner Layer Z order on WPF

"JFlorero" <JFlorero@xxxxxx> wrote in message
news:2FDA9A8F-8AD2-4A7E-B080-D1B405485259@xxxxxx
Quote:

> 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++

Quote:

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

>> 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
Quote:

>> > 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
Old 07-18-2008   #5 (permalink)
JFlorero
Guest


 
 

Re: Adorner Layer Z order on WPF


AdornerLayer MyAdornerLayer = AdornerLayer.GetAdornerLayer(MyUserControl);
MyAdornerLayer.Add(MyAdorner);

MyCanvas.Children.Add(MyUserControl);


Jimmy.


"Mark Salsbery [MVP]" wrote:
Quote:

> "JFlorero" <JFlorero@xxxxxx> wrote in message
> news:2FDA9A8F-8AD2-4A7E-B080-D1B405485259@xxxxxx
Quote:

> > 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++
>
>
Quote:

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

> >> 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
Old 07-18-2008   #6 (permalink)
JFlorero
Guest


 
 

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
 

Thread Tools


Similar Threads
Thread Forum
XAML Adorner and CalendarWeekPresenter - Drag Drop ???? .NET General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46