Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Button Style Not Applied If Command Is Set

$
0
0

Hi,

I have the following XAML:

<Window x:Class="button3D.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="MainWindow" Height="350" Width="525">
<Window.Resources>
          <Style TargetType="{x:Type Button}">
              ...
          </Style>
</Window.Resources>
<Grid Width="200" Height="200">
           <Button Name="buttonPaste" Command="Paste" Opacity="1">Paste</Button>
          <!--<Button Name="buttonPaste" Opacity="1">Paste</Button>-->
</Grid>
</Window>

Now, the problem is that though the style defines a rotating 3D button, the button does not rotate. Only if I use the commented-out button, it properly rotates. In other words, setting the command for the button makes it avoid rotating.

This happens no matter whether the style rotates the button  when the mouse is over the button (like in the following code) or when the button is pressed:

<Trigger Property="Button.IsMouseOver" Value="true">
          <Trigger.EnterActions>
                    <BeginStoryboard Storyboard="{StaticResource Spin}"/>
          </Trigger.EnterActions>
</Trigger>

Does anyone have an idea why is it, and how can I solve this?

Thanks in advance!


Ofer




Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>