Click here to Skip to main content
15,885,032 members
Home / Discussions / WPF
   

WPF

 
QuestionWPF ViewModel - Saving user Preferences Pin
Kevin Marois17-Mar-12 11:49
professionalKevin Marois17-Mar-12 11:49 
AnswerRe: WPF ViewModel - Saving user Preferences Pin
Mycroft Holmes17-Mar-12 15:01
professionalMycroft Holmes17-Mar-12 15:01 
QuestionHow To Create This Look Pin
Kevin Marois16-Mar-12 13:56
professionalKevin Marois16-Mar-12 13:56 
AnswerRe: How To Create This Look Pin
Mycroft Holmes16-Mar-12 14:12
professionalMycroft Holmes16-Mar-12 14:12 
AnswerRe: How To Create This Look Pin
Richard MacCutchan16-Mar-12 22:35
mveRichard MacCutchan16-Mar-12 22:35 
QuestionDataGrid Dynamic Data Pin
michaelgr116-Mar-12 5:03
michaelgr116-Mar-12 5:03 
QuestionTileLayout control Pin
Nitin20TechBLR15-Mar-12 18:51
Nitin20TechBLR15-Mar-12 18:51 
QuestionUsing C# dependency property in XAML Triggers Pin
Prasoon Chaudhary15-Mar-12 0:30
Prasoon Chaudhary15-Mar-12 0:30 
While creating style for a button I am writing like this:

HTML
<Style x:Key="MagButtonStyle" TargetType="{x:Type Button}">
	<Setter Property="Template">
	<Setter.Value>
	 <ControlTemplate TargetType="{x:Type Button}">
	  <Grid>
                <Image Name="Normal" Source="Resources/Images/n0.png"/>
		<Image Name="RollOver1" Source="Resources/Images/r1.png" Visibility="Hidden"/>
                <Image Name="RollOver2" Source="Resources/Images/r2.png" Visibility="Hidden"/>
                <Image Name="RollOver3" Source="Resources/Images/r3.png" Visibility="Hidden"/>
          </Grid>
         <ControlTemplate.Triggers>
           <Trigger Property="IsMouseOver" Value="True">
               <Setter TargetName="Normal" Property="Visibility" Value="Hidden"/>
               <Setter TargetName="RollOver1" Property="Visibility" Value="Visible"/>
           </Trigger> 
</Style>


Can we control this trigger by some global variable/ dependency property defined in c# code? So, we would be able to use it with Multi-trigger?

Basically my requirement is to display different images based on property "DepProp". I need to be able to wrtite something like this:

<Trigger Property="DepProp" Value="1">
               <Setter TargetName="RollOver1" Property="Visibility" Value="Visible"/>
            </Trigger>
<Trigger Property="DepProp" Value="2">
               <Setter TargetName="RollOver2" Property="Visibility" Value="Visible"/>
            </Trigger>


Is it possible?

Other way around would be to access these style objects on mouseenter in c# code. Possible? If yes, how?

Which way will be better?
AnswerRe: Using C# dependency property in XAML Triggers Pin
George Nistor15-Mar-12 7:00
George Nistor15-Mar-12 7:00 
AnswerRe: Using C# dependency property in XAML Triggers Pin
Pete O'Hanlon15-Mar-12 7:35
mvePete O'Hanlon15-Mar-12 7:35 
GeneralRe: Using C# dependency property in XAML Triggers Pin
Prasoon Chaudhary15-Mar-12 23:38
Prasoon Chaudhary15-Mar-12 23:38 
AnswerRe: Using C# dependency property in XAML Triggers Pin
George Nistor15-Mar-12 23:29
George Nistor15-Mar-12 23:29 
GeneralRe: Using C# dependency property in XAML Triggers Pin
Prasoon Chaudhary15-Mar-12 23:40
Prasoon Chaudhary15-Mar-12 23:40 
QuestionWhat Does This Do? Pin
Kevin Marois13-Mar-12 12:53
professionalKevin Marois13-Mar-12 12:53 
AnswerRe: What Does This Do? Pin
Abhinav S14-Mar-12 20:13
Abhinav S14-Mar-12 20:13 
QuestionWhat's the best control for ..... Pin
Sutton Mehaffey13-Mar-12 11:34
Sutton Mehaffey13-Mar-12 11:34 
AnswerRe: What's the best control for ..... Pin
Pete O'Hanlon13-Mar-12 11:41
mvePete O'Hanlon13-Mar-12 11:41 
GeneralRe: What's the best control for ..... Pin
Sutton Mehaffey14-Mar-12 3:27
Sutton Mehaffey14-Mar-12 3:27 
GeneralRe: What's the best control for ..... Pin
Pete O'Hanlon14-Mar-12 5:24
mvePete O'Hanlon14-Mar-12 5:24 
GeneralRe: What's the best control for ..... Pin
Sutton Mehaffey14-Mar-12 6:58
Sutton Mehaffey14-Mar-12 6:58 
GeneralRe: What's the best control for ..... Pin
Pete O'Hanlon14-Mar-12 7:02
mvePete O'Hanlon14-Mar-12 7:02 
GeneralRe: What's the best control for ..... Pin
Sutton Mehaffey14-Mar-12 10:12
Sutton Mehaffey14-Mar-12 10:12 
GeneralRe: What's the best control for ..... Pin
Pete O'Hanlon14-Mar-12 10:25
mvePete O'Hanlon14-Mar-12 10:25 
GeneralRe: What's the best control for ..... Pin
Sutton Mehaffey14-Mar-12 10:44
Sutton Mehaffey14-Mar-12 10:44 
GeneralRe: What's the best control for ..... Pin
Pete O'Hanlon14-Mar-12 10:50
mvePete O'Hanlon14-Mar-12 10:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.