WPF Data Triggers and Story Boards

What you want is possible by declaring the animation on the progressWheel itself: The XAML: <UserControl x:Class=”TriggerSpike.UserControl1″ xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” Height=”300″ Width=”300″> <UserControl.Resources> <DoubleAnimation x:Key=”SearchAnimation” Storyboard.TargetProperty=”Opacity” To=”1″ Duration=”0:0:4″/> <DoubleAnimation x:Key=”StopSearchAnimation” Storyboard.TargetProperty=”Opacity” To=”0″ Duration=”0:0:4″/> </UserControl.Resources> <StackPanel> <TextBlock Name=”progressWheel” TextAlignment=”Center” Opacity=”0″> <TextBlock.Style> <Style> <Style.Triggers> <DataTrigger Binding=”{Binding IsBusy}” Value=”True”> <DataTrigger.EnterActions> <BeginStoryboard> <Storyboard> <StaticResource ResourceKey=”SearchAnimation”/> </Storyboard> </BeginStoryboard> </DataTrigger.EnterActions> <DataTrigger.ExitActions> <BeginStoryboard> … Read more

Windows Phone 7 (WP7) Change a button’s background color on click

What you need to do is create a button template that modifies the Pressed visual state. In blend, select your button, click the menu item “Object”->”Edit Template”->”Edit a Copy…” and a new template is created. In the States window, select the Pressed visual state in the CommonStates visual state group. Now select ButtonBackground in the … Read more

Is there a way to check if WPF is currently executing in design mode or not?

I believe you are looking for GetIsInDesignMode, which takes a DependencyObject. Ie. // ‘this’ is your UI element DesignerProperties.GetIsInDesignMode(this); Edit: When using Silverlight / WP7, you should use IsInDesignTool since GetIsInDesignMode can sometimes return false while in Visual Studio: DesignerProperties.IsInDesignTool Edit: And finally, in the interest of completeness, the equivalent in WinRT / Metro / … Read more

MVVM Passing EventArgs As Command Parameter

It’s not easily supported. Here’s an article with instructions on how to pass EventArgs as command parameters. You might want to look into using MVVMLight – it supports EventArgs in command directly; your situation would look something like this: <i:Interaction.Triggers> <i:EventTrigger EventName=”Navigated”> <cmd:EventToCommand Command=”{Binding NavigatedEvent}” PassEventArgsToCommand=”True” /> </i:EventTrigger> </i:Interaction.Triggers>