Windows Vista Forums

Specifying Dynamic Values in XAML?
  1. #1


    john Guest

    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

  2. #2


    Laurent Bugnion Guest

    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

  3. #3


    john Guest

    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

Specifying Dynamic Values in XAML? problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to include XAML files into another XAML file? star-italia .NET General 6 12 Jun 2008
dynamic loading xaml Dave Avalon 0 27 Nov 2007
launching different XAML aplication from another XAML app SenthilVel Avalon 0 31 Mar 2007
How to deploy an XAML-based App with its XAML-UI-File? Solveigh Avalon 6 08 Nov 2006
File.xaml and File.xaml.cs are atomically checked out/in from sourcesafe Pascal Bourque Avalon 1 26 Apr 2006