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

Trigger on user dependency property

Closed Thread
 
Thread Tools Display Modes
Old 01-31-2006   #1 (permalink)
Griff
Guest


 

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#)
Old 01-31-2006   #2 (permalink)
Griff
Guest


 

RE: Trigger on user dependency property

I guess "Doh" is in order.

I was referring to my dependency property as Button.IsStuckDown
It would make more sense to refer to it as myButton.IsStuckDown as the
standard button doesn't have one of these.
In fact just IsStuckDown worked.


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


"Griff" wrote:

> 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#)

Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Style trigger on attached property Michael Latta Avalon 1 10-04-2006 07:25 AM
Set BorderThickness.Top Property in Trigger with TemplateBinding Thomas Mueller Avalon 1 05-31-2006 08:26 AM
Paragraph.Text? Should there be a dependency property as well? Jason Dolinger Avalon 11 01-31-2006 06:59 AM
Dependency property not initialized in OnPropertyChanged? Jared Bienz Avalon 0 01-10-2006 03:53 PM
Custom Dependency Property and Binding CSkinner Avalon 3 01-10-2006 03:53 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