11using System ;
22using System . Diagnostics ;
3+ using System . Linq ;
34using System . Runtime . InteropServices ;
45using System . Windows ;
56using System . Windows . Controls ;
@@ -59,6 +60,7 @@ static GraphHostControl()
5960 private GraphControl graphControl ;
6061 private Button searchButton ;
6162 private Button showTextButton ;
63+ private Button showVerticesButton ;
6264 private TextBox searchTextBox ;
6365
6466 public Digraph Graph
@@ -112,6 +114,7 @@ private void UpdateVisibility()
112114 ? Visibility . Visible
113115 : Visibility . Collapsed ;
114116 showTextButton . Visibility = textVisibility ;
117+ showVerticesButton . Visibility = textVisibility ;
115118 searchButton . Visibility = searchVisibility ;
116119 }
117120
@@ -123,7 +126,7 @@ private void Initialize()
123126 Orientation = Orientation . Horizontal ,
124127 MinHeight = 26
125128 } ;
126- var toolbar = new StackPanel ( )
129+ var toolbar = new WrapPanel ( )
127130 {
128131 Orientation = Orientation . Horizontal ,
129132 MinHeight = 26
@@ -157,7 +160,16 @@ private void Initialize()
157160
158161 showTextButton = new Button
159162 {
160- Content = "Show graph text" ,
163+ Content = "Text" ,
164+ VerticalAlignment = VerticalAlignment . Center ,
165+ Padding = new Thickness ( 0 , 0 , 8 , 0 ) ,
166+ Margin = new Thickness ( 0 , 0 , 8 , 0 ) ,
167+ BorderThickness = new Thickness ( )
168+ } ;
169+
170+ showVerticesButton = new Button
171+ {
172+ Content = "Vertices" ,
161173 VerticalAlignment = VerticalAlignment . Center ,
162174 Padding = new Thickness ( 0 , 0 , 8 , 0 ) ,
163175 Margin = new Thickness ( 0 , 0 , 8 , 0 ) ,
@@ -257,6 +269,16 @@ private void Initialize()
257269 DisplayText ? . Invoke ( text ) ;
258270 } ;
259271
272+ showVerticesButton . Click += ( s , e ) =>
273+ {
274+ var text = string . Join ( Environment . NewLine ,
275+ graphControl
276+ . GetVerticesToDisplay ( )
277+ . Select ( v => v . Title )
278+ . OrderBy ( s => s ) ) ;
279+ DisplayText ? . Invoke ( text ) ;
280+ } ;
281+
260282 depthCheckbox . Checked += ( s , e ) =>
261283 {
262284 graphControl . LayerByDepth = true ;
@@ -285,6 +307,7 @@ private void Initialize()
285307 } ;
286308
287309 toolbar . Children . Add ( showTextButton ) ;
310+ toolbar . Children . Add ( showVerticesButton ) ;
288311 toolbar . Children . Add ( transitiveReduceCheck ) ;
289312 toolbar . Children . Add ( allEdgesCheckbox ) ;
290313 toolbar . Children . Add ( filterModeComboBox ) ;
0 commit comments