forked from ravendb/ravendb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/fitzchak1/ravendb
- Loading branch information
Showing
10 changed files
with
133 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="SelectItemOnRightClick.cs" company="Hibernating Rhinos LTD"> | ||
// Copyright (c) Hibernating Rhinos LTD. All rights reserved. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
using System.Linq; | ||
using System.Windows.Controls; | ||
using System.Windows.Input; | ||
using System.Windows.Interactivity; | ||
using System.Windows.Media; | ||
|
||
namespace Raven.Studio.Behaviors | ||
{ | ||
public class SelectItemOnRightClick : Behavior<ListBox> | ||
{ | ||
protected override void OnAttached() | ||
{ | ||
AssociatedObject.MouseRightButtonDown += AssociatedObjectOnMouseRightButtonDown; | ||
base.OnAttached(); | ||
} | ||
|
||
protected override void OnDetaching() | ||
{ | ||
AssociatedObject.MouseRightButtonDown -= AssociatedObjectOnMouseRightButtonDown; | ||
base.OnDetaching(); | ||
} | ||
|
||
void AssociatedObjectOnMouseRightButtonDown(object sender, MouseButtonEventArgs e) | ||
{ | ||
var item = VisualTreeHelper.FindElementsInHostCoordinates(e.GetPosition(null),AssociatedObject) | ||
.OfType<ListBoxItem>() | ||
.FirstOrDefault(); | ||
|
||
if (item == null || AssociatedObject.SelectedItems.Contains(item.DataContext)) | ||
return; | ||
|
||
AssociatedObject.SelectedItems.Clear(); | ||
item.IsSelected = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Reactive; | ||
using System.Reactive.Linq; | ||
|
||
namespace Raven.Studio.Infrastructure | ||
{ | ||
public static class RxExtensions | ||
{ | ||
public static IObservable<object> NoSignature<T>(this IObservable<EventPattern<T>> observable) where T : EventArgs | ||
{ | ||
return observable.Select(e => (object) null); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters