![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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#) |
| | #2 (permalink) |
| 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#) |
| |
| |
![]() |
| 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 |