KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I created behavior for DataGrid to detect double-click: public class DataGridDoubleClickBehavior : Behavior<DataGrid> { public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.Register( "CommandParameter", typeof(object), typeof(DataGridDoubleClickBehavior), new PropertyMetadata(null)); public object CommandParameter { get { return GetValue(CommandParameterProperty); } set { SetValue(CommandParameterProperty, value); } } public static readonly DependencyProperty DoubleClickCommandProperty = DependencyProperty.Register( "DoubleClickCommand", typeof(ICommand), typeof(DataGridDoubleClickBehavior), new PropertyMetadata(null)); public ICommand DoubleClickCommand { get { return (ICommand)GetValue(DoubleClickCommandProperty); } set { SetValue(DoubleClickCommandProperty, value); } } protected override void OnAttached() { this.AssociatedObject.LoadingRow += this.OnLoadingRow; this.AssociatedObject.UnloadingRow += this.OnUnloadingRow; base.OnAttached(); } protected override void OnDetaching() { this.AssociatedObject.LoadingRow -= this.OnLoadingRow; this.AssociatedObject.UnloadingRow -= this.OnUnloadingRow; base.OnDetaching(); } private void OnLoadingRow(object sender, DataGridRowEventArgs e) { e.Row.MouseLeftButtonUp += this.OnMouseLeftButtonUp; } private void OnUnloadingRow(object sender, DataGridRowEventArgs e) { e.Row.MouseLeftButtonUp -= this.OnMouseLeftButtonUp; } private void OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { i
Tags (comma-separated)
Save Edits
Cancel