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 - Specifying Dynamic Values in XAML?

 
 
Old 12-03-2006   #1 (permalink)
john


 
 

Specifying Dynamic Values in XAML?

All:

In developing a custom control (UserControl), I have a StackPanel with
a gradient background and a TextBlock. This works fine. Now, I am
attempting to round the corners of the StackPanel. I can do this with
various clipping/Geometry objects, e.g., RectangleGeometry, etc.

Now, the problem I'm facing is that all of the clipping/geometry
objects seem to need a fixed size, e.g., Rect="0,0,100,100". Now, I
want my StackPanel to grow and shrink with it's parent (it is to be
placed on a Grid whose "cell" sizes grow and shrink with respect to the
host Window).

So, the goal is to have a rounded rect imposed on the StackPanel as it
grows and shrinks -- therefore, I cannot assign a fixed sized to the
clipping region/geometry -- I need the clipping region to grow in
shrink as well, in proportion to the StackPanel it's clipping.

Ideas? A better way to approach this?

Thanks,
John - jpuopolo


My System SpecsSystem Spec
Old 12-03-2006   #2 (permalink)
Laurent Bugnion


 
 

Re: Specifying Dynamic Values in XAML?

Hi,

john wrote:
> All:
>
> In developing a custom control (UserControl), I have a StackPanel with
> a gradient background and a TextBlock. This works fine. Now, I am
> attempting to round the corners of the StackPanel. I can do this with
> various clipping/Geometry objects, e.g., RectangleGeometry, etc.
>
> Now, the problem I'm facing is that all of the clipping/geometry
> objects seem to need a fixed size, e.g., Rect="0,0,100,100". Now, I
> want my StackPanel to grow and shrink with it's parent (it is to be
> placed on a Grid whose "cell" sizes grow and shrink with respect to the
> host Window).
>
> So, the goal is to have a rounded rect imposed on the StackPanel as it
> grows and shrinks -- therefore, I cannot assign a fixed sized to the
> clipping region/geometry -- I need the clipping region to grow in
> shrink as well, in proportion to the StackPanel it's clipping.
>
> Ideas? A better way to approach this?
>
> Thanks,
> John - jpuopolo


You think too much in GDI. Forget what you learned. You don't need to
draw the figures yourself. If you want to set borders to a StackPanel,
just use a Border control.

<StackPanel>
<Border CornerRadius="10" BorderBrush="Red" BorderThickness="5">
<TextBlock Text="Hello" />
</Border>
</StackPanel>

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
My System SpecsSystem Spec
Old 12-03-2006   #3 (permalink)
john


 
 

Re: Specifying Dynamic Values in XAML?

Laurent:

Guilty as charged - 15 years of Win32/.NET 2.0 conditioning...:-)

Thanks - I'll give it a try...

Best,
John


Laurent Bugnion wrote:
> Hi,
>
> john wrote:
> > All:
> >
> > In developing a custom control (UserControl), I have a StackPanel with
> > a gradient background and a TextBlock. This works fine. Now, I am
> > attempting to round the corners of the StackPanel. I can do this with
> > various clipping/Geometry objects, e.g., RectangleGeometry, etc.
> >
> > Now, the problem I'm facing is that all of the clipping/geometry
> > objects seem to need a fixed size, e.g., Rect="0,0,100,100". Now, I
> > want my StackPanel to grow and shrink with it's parent (it is to be
> > placed on a Grid whose "cell" sizes grow and shrink with respect to the
> > host Window).
> >
> > So, the goal is to have a rounded rect imposed on the StackPanel as it
> > grows and shrinks -- therefore, I cannot assign a fixed sized to the
> > clipping region/geometry -- I need the clipping region to grow in
> > shrink as well, in proportion to the StackPanel it's clipping.
> >
> > Ideas? A better way to approach this?
> >
> > Thanks,
> > John - jpuopolo

>
> You think too much in GDI. Forget what you learned. You don't need to
> draw the figures yourself. If you want to set borders to a StackPanel,
> just use a Border control.
>
> <StackPanel>
> <Border CornerRadius="10" BorderBrush="Red" BorderThickness="5">
> <TextBlock Text="Hello" />
> </Border>
> </StackPanel>
>
> HTH,
> Laurent
> --
> Laurent Bugnion, GalaSoft
> Software engineering: http://www.galasoft-LB.ch
> PhotoAlbum: http://www.galasoft-LB.ch/pictures
> Support children in Calcutta: http://www.calcutta-espoir.ch


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Is it possible to include XAML files into another XAML file? .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