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 - Trigger on user dependency property

 
 
Old 01-31-2006   #1 (permalink)
Griff


 
 

Trigger on user dependency property

I created a button that can be up, down, or "stuck down" for want of a better
description. I created a new type that overrides Button and created styles
and content templates linked to IsPressed state. I have 3 different
graphical representations of my custom button.

To display the button in the "stuck down" position (ie when used as part of
a RadioGroup) I temporarily used the existing IsEnabled = "true" state to
trigger the display of the "stuck down" position (ande set it from code when
appropriate). But that was only because I was in a hurry and I couldn't
figure out how to do anything more appropriate.
It all works, but clearly this is not what "IsEnabled" is for. What is
more, should anyone try to disable my button they'll get some unintended
behaviour.

Now, revisiting this with a bit more breathing time, I'd like to use a
custom dependency property (ie "IsStuckDown") that will be set from code and
will be referenced in the Style.Triggers as below

<Trigger Property="Button.IsStuckDown" Value="true">
<Setter Property="Template" Value="{StaticResource
ButtonStuckDownTemplate}" />


This is all fine except that when I add
="Button.IsStuckDown"
in place of
="Button.IsEnabled"
in the code above
I get a BAML runtime exception that tells me very little.

the dependency property "IsStuckDown" is all there and working.

Is this supposed to be possible ? Or am I doing something that is not
actually supported ?


Thanks
--
Griff
(trying to make an industrial UI with XAML/WPF/c#)

My System SpecsSystem Spec
 

Thread Tools



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