![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | Can trigger work outside a style ? I'm really confused, I have a Stack Panel Inside it there is a StackPanel.Triggers section which is declared as <StackPanel.Triggers> <EventTrigger RoutedEvent="ToggleButton.Checked" SourceName="ResizeButton"> <EventTrigger.Actions> <BeginStoryboard Storyboard="{StaticResource ExpandCart}" x:Name="ExpandCart_BeginStoryboard"/> </EventTrigger.Actions> </EventTrigger> <EventTrigger RoutedEvent="ToggleButton.Unchecked" SourceName="ResizeButton"> <EventTrigger.Actions> <BeginStoryboard Storyboard="{StaticResource ShrinkCart}" x:Name="ShrinkCart_BeginStoryboard"/> </EventTrigger.Actions> </EventTrigger> <EventTrigger RoutedEvent="ToggleButton.Checked" SourceName="InStorePickupButton"> <EventTrigger.Actions> <Setter Property="Visibility" Value="Visible" TargetName="InStorePickupOptions"/> </EventTrigger.Actions> </EventTrigger> <EventTrigger RoutedEvent="ToggleButton.Checked" SourceName="ShipToButton"> <EventTrigger.Actions> <Setter Property="Visibility" Value="Visible" TargetName="ShipToOptions"/> </EventTrigger.Actions> </EventTrigger> </StackPanel.Triggers> The above fails miserably since .NET decides that Visibility can't be set because it's a DependentProperty. However, the following in the same page works <ControlTemplate.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="Visibility" Value="Visible" TargetName="Action" /> <Setter Property="Foreground" Value="#ffffffff"/> </Trigger> <Trigger Property="IsSelected" Value="False"> <Setter Property="Visibility" Value="Collapsed" TargetName="Action" /> </Trigger> </ControlTemplate.Triggers> The difference is that one acts on the ControlTemplate of one of the control and the other works on the whole page. Why can't I apply the same kind of behavior that I use on a control template inside a page? Please help Phil |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Can trigger work outside a style ? The first thing I can see that might be wrong about this is that "Trigger" class uses a collection os "SetterBase" and "EventTrigger" use a collection of "TriggerAction" as their content properties... This mean that normally, "Setter" is not a valid item for the "EventTrigger" class. You could try to place a trigger onto a DP in your custom StackPanel declaration that would perform the same function as your "Checked" or "Unchecked"... Marcus |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| DllImport doesn't work in ASP.NET for old C-style dlls | .NET General | |||
| Font Size - XP style vs Vista style | Vista General | |||
| Font Size - XP style vs Vista style | Vista General | |||
| Windows API to trigger schedule tasks does not work for Vista | Vista General | |||