Click here to Skip to main content
15,039,525 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,
I still get a bit confused wen it comes to triggers in WPF so please help.I am totally lost here .Following is part of my code.

                             I want to put a condition here saying if select button is clicked(the select button is a ribbon toggle button) then only on mouse over the decorator shoulds be visble
                           <Setter TargetName="Decorator" Property="Visibility" Value="Visible"/>

<Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="Decorator" Property="Visibility" Value="Visible"/>

I hope I am clear with this question.the ribbon button is in another xaml file
All I want is after I click the ribbon button "select" on mouseover the decorator shoulds be visible else hidden if we can do this in code behind on button click also ok but I am not sure how to change the property that is set on another xaml file.

Thanks in advance


Create a style resource by adding resource file to your project
In that resource define a style for the ribbon button and on style.trigger define your decorator visibility proeprty

Hope this helps.

If you want conditions on Dependency Properties, you can use a MultiTrigger.

If your have conditions on properties the aren't Dependency Properties, you can use a MultiDataTrigger.

There are examples of the use of these triggers in the MSDN topics about them.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900