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 - Using StackPanel and User Controls

 
 
Old 02-25-2007   #1 (permalink)
Jay


 
 

Using StackPanel and User Controls

Hello,

I have a Window, which contains a stackpanel. I've added two WPF
UserControls, each of which contains a Canvas and some elements within the
canvases.

The problem I have the two User Controls stacked, however, it appears the
second Canvas's elements are drawing from the top of the Window, not the
second canvas. I can place a TextBlock in the Canvas and set Canvas.Top="1",
however, the "1" is set from the Window, not the Canvas in which it is
contained. Maybe it's taking a cue from the first Canvas.

Anyone know how to address this issue? Or what I'm doing wrong? I'd rather
not compensate for this in the User Control, as I want them to be separate,
and not know what the other is doing.



My System SpecsSystem Spec
Old 03-23-2007   #2 (permalink)
WPCoder


 
 

Re: Using StackPanel and User Controls

Are you explicitly setting the height of the UserControls you're adding (and
the contained Cavnas?). I'd think you'd want to use a container class that
sizes to fit rather than using a Cavnas. There's no containment on the
canvas, although I wouldn't expect it to do what you're describing exactly.

--Aaron

http://www.wiredprairie.us


"Jay" <jipock@acm.org> wrote in message
news:e6GOaYUWHHA.5060@TK2MSFTNGP06.phx.gbl...
> Hello,
>
> I have a Window, which contains a stackpanel. I've added two WPF
> UserControls, each of which contains a Canvas and some elements within the
> canvases.
>
> The problem I have the two User Controls stacked, however, it appears the
> second Canvas's elements are drawing from the top of the Window, not the
> second canvas. I can place a TextBlock in the Canvas and set
> Canvas.Top="1", however, the "1" is set from the Window, not the Canvas in
> which it is contained. Maybe it's taking a cue from the first Canvas.
>
> Anyone know how to address this issue? Or what I'm doing wrong? I'd rather
> not compensate for this in the User Control, as I want them to be
> separate, and not know what the other is doing.
>


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
User account controls Vista security
User Account Controls Vista security


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