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

Accessing EventArgs of RoutedEvent in XAML

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 06-17-2008   #1 (permalink)
Jens Weiermann
Guest


 

Accessing EventArgs of RoutedEvent in XAML

Hi,

I'm relatively new to XAML, so please bear with me if I'm what I'm planning
to do is stupid. I'm not a big fan (yet) of the rather crazy syntax,
especially when using {binding} and name:spaces. But I like the strict
separation of logic and UI and would like to continue doing it that way.

I'm firing a custom RoutedEvent from my Window class and use this as an
event trigger in the XAML code. This works fine so far:

<EventTrigger RoutedEvent="foo:Window3.BarEvent">
<EventTrigger.Actions>
<BeginStoryboard>
...

I'm doing this to display an error message under certain conditions
(showing a big red and blinking panel to the user).

What I've not found out is how one can use the event args of the
RoutedEvent in the XAML code. I would like to pass the error message as a
parameter to that event, so the trigger can assign it to the text property
of a label control (probably by using an ObjectAnimationBase derived
animation). What I'm having in mind is something like this:

<EventTrigger RoutedEvent="foo:Window3.BarEvent">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard Duration="00:00:10">
<ObjectAnimationUsingKeyFrames
Storyboard.TargetName="SomeLabel" Storyboard.TargetProperty="Text">
<DiscreteObjectKeyFrame KeyTime="00:00:00"
Value="{BarEventArgs:ErrorMessage}" />

However, I have not found a way to access the arguments passed to the
RoutedEvent in XAML code.

I'd appreciate any suggestions...

Thanks!
Jens

My System SpecsSystem Spec
Old 06-30-2008   #2 (permalink)
Jens Weiermann
Guest


 

Re: Accessing EventArgs of RoutedEvent in XAML

As a follow up to my own post: is this the right group to ask such
questions? I'm wondering because noone answered what I'd considered an easy
question...

Jens
My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in accessing a wcf service through wpf-xaml ram Avalon 0 04-19-2007 03:06 AM
RoutedEvent Problems MarkS Avalon 1 03-23-2007 11:32 AM
Accessing an Array element(i) from a XAML "binding path" iterationx Avalon 1 03-23-2007 11:17 AM
Custom RoutedEvent in EventTrigger of CustomControl Style. Illumineo Avalon 1 08-17-2006 07:05 PM
Accessing items in XAML from code Griff Avalon 3 01-12-2006 02:07 AM


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