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

Can trigger work outside a style ?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 03-15-2006   #1 (permalink)
Philippe Lavoie
Guest


 

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 SpecsSystem Spec
Old 03-15-2006   #2 (permalink)
Marcus
Guest


 

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 SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
DllImport doesn't work in ASP.NET for old C-style dlls Chris Bordeman .NET General 0 04-10-2008 05:31 PM
Font Size - XP style vs Vista style John M. Dlugosz Vista General 0 02-19-2008 06:48 PM
Font Size - XP style vs Vista style John M. Dlugosz Vista General 1 02-19-2008 09:57 AM
Windows API to trigger schedule tasks does not work for Vista Ajoschi Vista General 0 11-06-2006 07:36 AM
Style trigger on attached property Michael Latta Avalon 1 10-04-2006 07:25 AM


Update your Vista Drivers Update Your Vista Drivers Now!!

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
Page generated in 0.24290 seconds with 10 queries