2013-05-23

 

This behavior brings you a double click possibility to every kind of controls. You can use it for example in lists for display the details for the double clicked item.

 

alt

Usage

<UserControl x:Class="DW.Interactivity.Demo.DoubleClickBehaviorControl"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:Interactivity="http://schemas.my-libraries.de/wpf/interactivity">
	<Grid>
		<TextBlock Text="Doubleclick this text"
				   Interactivity:DoubleClickBehavior.Command="{Binding DoubleClickCommand}" />
	</Grid>
</UserControl>
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using DW.SharpTools;

namespace DW.Interactivity.Demo
{
	public partial class DoubleClickBehaviorControl : UserControl
	{
		public DoubleClickBehaviorControl()
		{
			InitializeComponent();
			DataContext = this;

			DoubleClickCommand = new DelegateCommand(p => DoubleClick());
		}

		public ICommand DoubleClickCommand { get; set; }
		private void DoubleClick()
		{
			MessageBox.Show("Well done");
		}
	}
}