File tree 3 files changed +37
-6
lines changed 3 files changed +37
-6
lines changed Original file line number Diff line number Diff line change 1
1
#nullable enable
2
2
3
3
using CodeNav . Helpers ;
4
+ using Microsoft . VisualStudio . PlatformUI ;
4
5
using System ;
5
6
using System . Collections . Generic ;
6
7
using System . Linq ;
7
8
using System . Windows ;
9
+ using System . Windows . Input ;
8
10
using System . Windows . Media ;
9
11
10
12
namespace CodeNav . Models
@@ -69,5 +71,12 @@ public Visibility HasMembersVisibility
69
71
: Visibility . Collapsed ;
70
72
}
71
73
}
74
+
75
+ public ICommand ToggleIsExpandedCommand => new DelegateCommand ( ToggleIsExpanded ) ;
76
+ public void ToggleIsExpanded ( object args )
77
+ {
78
+ IsDoubleClicked = true ;
79
+ IsExpanded = ! IsExpanded ;
80
+ }
72
81
}
73
82
}
Original file line number Diff line number Diff line change 14
14
using System . Runtime . Serialization ;
15
15
using Task = System . Threading . Tasks . Task ;
16
16
using Microsoft . VisualStudio . Shell ;
17
+ using System . Threading ;
17
18
18
19
namespace CodeNav . Models
19
20
{
@@ -108,6 +109,8 @@ public bool ContextMenuIsOpen
108
109
set => SetProperty ( ref _contextMenuIsOpen , value ) ;
109
110
}
110
111
112
+ public bool IsDoubleClicked ;
113
+
111
114
#region Fonts
112
115
private float _fontSize ;
113
116
public float FontSize
@@ -199,10 +202,20 @@ public Color NameBackgroundColor
199
202
200
203
#region Commands
201
204
public ICommand ClickItemCommand => new DelegateCommand ( ClickItem ) ;
202
- public void ClickItem ( object args )
205
+ public void ClickItem ( ) => ClickItemAsync ( ) . FireAndForget ( ) ;
206
+
207
+ private async Task ClickItemAsync ( )
203
208
{
209
+ await Task . Delay ( 200 ) ;
210
+
211
+ if ( IsDoubleClicked )
212
+ {
213
+ IsDoubleClicked = false ;
214
+ return ;
215
+ }
216
+
204
217
HistoryHelper . AddItemToHistory ( this ) ;
205
- DocumentHelper . ScrollToLine ( StartLinePosition , FilePath ) . FireAndForget ( ) ;
218
+ await DocumentHelper . ScrollToLine ( StartLinePosition , FilePath ) ;
206
219
}
207
220
208
221
public ICommand GoToDefinitionCommand => new DelegateCommand ( GoToDefinition ) ;
Original file line number Diff line number Diff line change 69
69
<GradientStop Color =" Transparent" Offset =" 1" />
70
70
</LinearGradientBrush >
71
71
</Border .BorderBrush>
72
- <Button Command =" {Binding Path=ClickItemCommand}"
73
- CommandParameter =" {Binding StartLinePosition}"
74
- ContentTemplate =" {TemplateBinding HeaderTemplate}"
72
+ <Button ContentTemplate =" {TemplateBinding HeaderTemplate}"
75
73
ContentTemplateSelector =" {TemplateBinding HeaderTemplateSelector}"
76
74
Content =" {TemplateBinding Header}"
77
75
Padding =" {TemplateBinding Padding}"
88
86
Style =" {StaticResource {x:Static ToolBar.ButtonStyleKey}}"
89
87
DockPanel.Dock=" Top"
90
88
BorderThickness =" 0"
91
- Margin =" 4,0,0,0" />
89
+ Margin =" 4,0,0,0" >
90
+ <Button .InputBindings>
91
+
92
+ <MouseBinding
93
+ Gesture =" LeftDoubleClick"
94
+ Command =" {Binding Path=ToggleIsExpandedCommand}" />
95
+ <MouseBinding
96
+ Gesture =" LeftClick"
97
+ Command =" {Binding Path=ClickItemCommand}"
98
+ CommandParameter =" {Binding StartLinePosition}" />
99
+ </Button .InputBindings>
100
+ </Button >
92
101
</Border >
93
102
94
103
<ToggleButton
You can’t perform that action at this time.
0 commit comments