@@ -107,7 +107,7 @@ private void Initialize()
107107 MyMapView . GeometryEditor = _geometryEditor ;
108108
109109 // Create vertex and freehand tools for the combo box.
110- ToolComboBox . ItemsSource = _toolDictionary = new Dictionary < string , object > ( )
110+ _toolDictionary = new Dictionary < string , object > ( )
111111 {
112112 { "Vertex Tool" , new VertexTool ( ) } ,
113113 { "Reticle Vertex Tool" , new ReticleVertexTool ( ) } ,
@@ -118,6 +118,8 @@ private void Initialize()
118118 { "Triangle Shape Tool" , ShapeTool . Create ( ShapeToolType . Triangle ) }
119119 } ;
120120
121+ ToolComboBox . ItemsSource = _toolDictionary . Keys ;
122+
121123 // Have the vertex tool selected by default.
122124 ToolComboBox . SelectedIndex = 0 ;
123125
@@ -196,7 +198,8 @@ private void PolygonButton_Click(object sender, RoutedEventArgs e)
196198 private void ToolComboBox_SelectionChanged ( object sender , SelectionChangedEventArgs e )
197199 {
198200 // Set the geometry editor tool based on the new selection.
199- _geometryEditor . Tool = ( ( KeyValuePair < string , object > ) ToolComboBox . SelectedItem ) . Value as GeometryEditorTool ;
201+ GeometryEditorTool tool = _toolDictionary [ ToolComboBox . SelectedItem . ToString ( ) ] as GeometryEditorTool ;
202+ _geometryEditor . Tool = tool ;
200203
201204 // Account for case when vertex tool is selected and geometry editor is started with a polyline or polygon geometry type.
202205 // Ensure point and multipoint buttons are only enabled when the selected tool is a vertex tool.
0 commit comments