![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 Specs![]() |
| | #3 (permalink) |
| | 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 Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Is it possible to include XAML files into another XAML file? | .NET General | |||