Changing the style of a button to a different style through a mouseover in WPF
I have just started using WPF and I am trying to design an application for logging hours for my volunteering group. Anyhow I am trying to make my buttons look like the calculator for Windows 7 buttons since that application is also designed in WPF and it would also impress the whole group.
I have gotten them to look like the buttons from Calculator (I have styles that look like the function and the digit buttons) but I can't get them to behave in the same way (a picture of the normal, the MouseOver and the click are attached at the end). I have my .xaml structured in the following way, I have baseStyleButton
and baseStyleButtonMouseOver
(I need help with defining this style too) defined in app.xaml and then I want to design styleButtonUnivers开发者_Python百科al
that "encapsulates" the two base styles and switches between them when the MouseOver
event occurs. Similarly, I want to be able to extend this style to have a click
event style too.
How do I achieve this in WPF or is there some other way that I can design my buttons that they both look cool and they are easy for a WPF beginner?
Also if anyone has any tips on how to achieve the MouseOver look of the calculator button, that would also be greatly appreciated.
I'm assuming your already using a control template?
You can apply style triggers as follows
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="ControlTemplate" Value="{StaticResource baseStyleButtonMouseOver}" />
</Trigger>
</Style.Triggers>
精彩评论