diff --git a/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Geometry/CreateAndEditGeometries/CreateAndEditGeometries.xaml b/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Geometry/CreateAndEditGeometries/CreateAndEditGeometries.xaml index 5f2f7dee51..2c4e8400ae 100644 --- a/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Geometry/CreateAndEditGeometries/CreateAndEditGeometries.xaml +++ b/src/WinUI/ArcGIS.WinUI.Viewer/Samples/Geometry/CreateAndEditGeometries/CreateAndEditGeometries.xaml @@ -65,7 +65,6 @@ Grid.ColumnSpan="2" HorizontalAlignment="Stretch" Background="White" - DisplayMemberPath="Key" SelectionChanged="ToolComboBox_SelectionChanged" ToolTipService.ToolTip="Tools" /> () + _toolDictionary = new Dictionary() { { "Vertex Tool", new VertexTool() }, { "Reticle Vertex Tool", new ReticleVertexTool() }, @@ -118,6 +118,8 @@ private void Initialize() { "Triangle Shape Tool", ShapeTool.Create(ShapeToolType.Triangle) } }; + ToolComboBox.ItemsSource = _toolDictionary.Keys; + // Have the vertex tool selected by default. ToolComboBox.SelectedIndex = 0; @@ -196,7 +198,8 @@ private void PolygonButton_Click(object sender, RoutedEventArgs e) private void ToolComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Set the geometry editor tool based on the new selection. - _geometryEditor.Tool = ((KeyValuePair)ToolComboBox.SelectedItem).Value as GeometryEditorTool; + GeometryEditorTool tool = _toolDictionary[ToolComboBox.SelectedItem.ToString()] as GeometryEditorTool; + _geometryEditor.Tool = tool; // Account for case when vertex tool is selected and geometry editor is started with a polyline or polygon geometry type. // Ensure point and multipoint buttons are only enabled when the selected tool is a vertex tool.