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 - How to set Fill on a Path

 
 
Old 07-10-2007   #1 (permalink)
John Solgat


 
 

How to set Fill on a Path

Hi,

I have some Resources defined as follows

<Window.Resources>
<SolidColorBrush x:Key="0685A1-Blue" Color="#FF0685A1"/>
<SolidColorBrush x:Key="911E13-Red" Color="#FF911E13"/>
<SolidColorBrush x:Key="662585-Purple" Color="#FF662585"/>
<SolidColorBrush x:Key="1FB52C-Green" Color="#FF1FB52C"/>
<SolidColorBrush x:Key="825B08-Brown" Color="#FF825B08"/>
</Window.Resources>

I have this Path in my XAML file:

<Path Stretch="Fill" Stroke="#FF00F0A3" StrokeThickness="5" Width="440"
Height="748" Canvas.Left="-542.5" Canvas.Top="-823.5" Data="F1 M220,-173.5
C340.12192,-173.5 437.5,-126.96686 437.5,-69.565277 L437.4718,-69.03228
437.5,-69.03228 437.5,22.499996 437.5,465.56528 437.5,467.16428 437.5,551.5
C437.5,562.54572 428.54568,571.5 417.5,571.5 L22.499998,571.5
C11.454305,571.5 2.5,562.54572 2.5000014,551.5 L2.5000014,22.499996
2.5000124,22.499886 2.5000124,-69.03228 2.528199,-69.03228
C2.5009389,-69.209641 2.5000038,-69.387398 2.5000014,-69.565277
2.5000038,-126.96686 99.878075,-173.5 220,-173.5 z" ClipToBounds="False"
Fill="{DynamicResource 1FB52C-Green}">

This path uses one of the resources.

How can I change the fill in my code behind file (C#) to use one of the
other resources? I can get at the Path, but there is no Fill property. I'm
guessing that it would be SetValue, but can't get the syntax that I need.

Thanks,
--
John Solgat
Renown Solutions

My System SpecsSystem Spec
Old 07-10-2007   #2 (permalink)
Laurent Bugnion, MVP


 
 

Re: How to set Fill on a Path

Hi,

Actually, there is a Path.Fill property, which is a Brush and which is
inherited from Shape.Fill. So you can TryFindResource the other brush,
and assign that value to the Path.Fill property.
http://msdn2.microsoft.com/en-us/lib...hape.fill.aspx

HTH,
Laurent


John Solgat wrote:
> Hi,
>
> I have some Resources defined as follows
>
> <Window.Resources>
> <SolidColorBrush x:Key="0685A1-Blue" Color="#FF0685A1"/>
> <SolidColorBrush x:Key="911E13-Red" Color="#FF911E13"/>
> <SolidColorBrush x:Key="662585-Purple" Color="#FF662585"/>
> <SolidColorBrush x:Key="1FB52C-Green" Color="#FF1FB52C"/>
> <SolidColorBrush x:Key="825B08-Brown" Color="#FF825B08"/>
> </Window.Resources>
>
> I have this Path in my XAML file:
>
> <Path Stretch="Fill" Stroke="#FF00F0A3" StrokeThickness="5" Width="440"
> Height="748" Canvas.Left="-542.5" Canvas.Top="-823.5" Data="F1 M220,-173.5
> C340.12192,-173.5 437.5,-126.96686 437.5,-69.565277 L437.4718,-69.03228
> 437.5,-69.03228 437.5,22.499996 437.5,465.56528 437.5,467.16428 437.5,551.5
> C437.5,562.54572 428.54568,571.5 417.5,571.5 L22.499998,571.5
> C11.454305,571.5 2.5,562.54572 2.5000014,551.5 L2.5000014,22.499996
> 2.5000124,22.499886 2.5000124,-69.03228 2.528199,-69.03228
> C2.5009389,-69.209641 2.5000038,-69.387398 2.5000014,-69.565277
> 2.5000038,-126.96686 99.878075,-173.5 220,-173.5 z" ClipToBounds="False"
> Fill="{DynamicResource 1FB52C-Green}">
>
> This path uses one of the resources.
>
> How can I change the fill in my code behind file (C#) to use one of the
> other resources? I can get at the Path, but there is no Fill property. I'm
> guessing that it would be SetValue, but can't get the syntax that I need.
>
> Thanks,


--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft.ch
PhotoAlbum: http://www.galasoft.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
To: why won't it auto fill Vista mail
Auto fill Vista mail
BUG? (Test-Path $path -IsValid) and empty $path PowerShell
BUG/ANNOYANCE: PoSH autocompletes the full path rather than a minimal path PowerShell


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