Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

How to set Fill on a Path

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 07-10-2007   #1 (permalink)
John Solgat
Guest


 

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
Guest


 

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
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Fill SueZee Vista mail 1 02-08-2008 08:33 PM
To: why won't it auto fill BAD Vista mail 1 11-03-2007 01:01 PM
BUG? (Test-Path $path -IsValid) and empty $path =?Utf-8?B?Um9tYW4gS3V6bWlu?= PowerShell 1 08-28-2006 12:10 PM
BUG/ANNOYANCE: PoSH autocompletes the full path rather than a minimal path Adam Milazzo [MSFT] PowerShell 2 08-12-2006 03:14 AM
Binding(string path) - what is the syntax for the path? Jason Dolinger Avalon 2 01-10-2006 03:52 PM


Vistax64.com 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 2005-2008

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 47 48 49 50 51