![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| Thread Tools | |
| |