Here is a similar but simpler class you can use:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Interactivity;
using System.Windows.Threading;
namespace SilverlightApplication14
{
public class LongClickButton : Button
{
public event EventHandler LongClick;
public static DependencyProperty HowLongProperty = DependencyProperty.Register("HowLong", typeof(double), typeof(LongClickButton), new PropertyMetadata(3000.0));
public double HowLong
{
get
{
return (double)this.GetValue(HowLongProperty);
}
set
{
this.SetValue(HowLongProperty, value);
}
}
private DispatcherTimer timer;
public LongClickButton()
{
this.timer = new DispatcherTimer();
this.timer.Tick += new EventHandler(timer_Tick);
}
private void timer_Tick(object sender, EventArgs e)
{
this.timer.Stop();
// Timer elapsed while button was down, fire long click event.
if (this.LongClick != null)
{
this.LongClick(this, EventArgs.Empty);
}
}
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
this.timer.Interval = TimeSpan.FromMilliseconds(this.HowLong);
this.timer.Start();
}
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonUp(e);
this.timer.Stop();
}
}
}
With this, you can use any of the standard behaviors in Blend along with the new LongClick event. Set the HowLong property to the number of ms you want (default is 3000) and then use an eventtrigger set to LongClick to trigger your navigation:
<local:LongClickButton Margin="296,170,78,91">
<i:Interaction.Triggers>
<i:EventTrigger EventName="LongClick">
<ei:ChangePropertyAction PropertyName="Background" TargetName="LayoutRoot">
<ei:ChangePropertyAction.Value>
<SolidColorBrush Color="#FFFF1C1C"/>
</ei:ChangePropertyAction.Value>
</ei:ChangePropertyAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</local:LongClickButton>