File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 26
26
using System . Windows . Documents ;
27
27
using System . Windows . Input ;
28
28
using System . Linq ;
29
+ using ICSharpCode . AvalonEdit . Utils ;
29
30
30
31
namespace ICSharpCode . AvalonEdit . CodeCompletion
31
32
{
@@ -180,8 +181,11 @@ protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
180
181
{
181
182
base . OnMouseDoubleClick ( e ) ;
182
183
if ( e . ChangedButton == MouseButton . Left ) {
183
- e . Handled = true ;
184
- RequestInsertion ( e ) ;
184
+ // only process double clicks on the ListBoxItems, not on the scroll bar
185
+ if ( ExtensionMethods . VisualAncestorsAndSelf ( e . OriginalSource as DependencyObject ) . TakeWhile ( obj => obj != this ) . Any ( obj => obj is ListBoxItem ) ) {
186
+ e . Handled = true ;
187
+ RequestInsertion ( e ) ;
188
+ }
185
189
}
186
190
}
187
191
Original file line number Diff line number Diff line change @@ -209,6 +209,14 @@ public static Rect ToWpf(this System.Drawing.Rectangle rect)
209
209
}
210
210
#endregion
211
211
212
+ public static IEnumerable < DependencyObject > VisualAncestorsAndSelf ( this DependencyObject obj )
213
+ {
214
+ while ( obj != null ) {
215
+ yield return obj ;
216
+ obj = VisualTreeHelper . GetParent ( obj ) ;
217
+ }
218
+ }
219
+
212
220
[ Conditional ( "DEBUG" ) ]
213
221
public static void CheckIsFrozen ( Freezable f )
214
222
{
You can’t perform that action at this time.
0 commit comments