void OnControlSelectionChanged(object?sender, WSelectionChangedEventArgs e) { if (VirtualView != null && NativeView != null) { VirtualView.SelectedIndex = NativeView.SelectedIndex; } }
private void RendererTypes_SelectionChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e) { // Get the user choice for the raster stretch render string myRendererTypeChoice = e.AddedItems[0].ToString(); switch (myRendererTypeChoice) { case "Min Max": // This section displays/resets the user choice options for MinMaxStretchParameters // Make sure all the GUI items are visible FirstParameterLabel.Visibility = Visibility.Visible; SecondParameterLabel.Visibility = Visibility.Visible; FirstParameterInput.Visibility = Visibility.Visible; SecondParameterInput.Visibility = Visibility.Visible; // Define what values/options the user sees FirstParameterLabel.Text = "Minimum value (0 - 255):"; SecondParameterLabel.Text = "Maximum value (0 - 255):"; FirstParameterInput.Text = "10"; SecondParameterInput.Text = "150"; break; case "Percent Clip": // This section displays/resets the user choice options for PercentClipStretchParameters // Make sure all the GUI items are visible FirstParameterLabel.Visibility = Visibility.Visible; SecondParameterLabel.Visibility = Visibility.Visible; FirstParameterInput.Visibility = Visibility.Visible; SecondParameterInput.Visibility = Visibility.Visible; // Define what values/options the user sees FirstParameterLabel.Text = "Minimum (0 - 100):"; SecondParameterLabel.Text = "Maximum (0 - 100)"; FirstParameterInput.Text = "0"; SecondParameterInput.Text = "50"; break; case "Standard Deviation": // This section displays/resets the user choice options for StandardDeviationStretchParameters // Make sure that only the necessary GUI items are visible FirstParameterLabel.Visibility = Visibility.Visible; SecondParameterLabel.Visibility = Visibility.Collapsed; FirstParameterInput.Visibility = Visibility.Visible; SecondParameterInput.Visibility = Visibility.Collapsed; // Define what values/options the user sees FirstParameterLabel.Text = "Factor (.25 to 4):"; FirstParameterInput.Text = "0.5"; break; } }
private void AreasList_SelectionChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e) { // Update the download button to reflect if the map area has already been downloaded. if (Directory.Exists(Path.Combine(_offlineDataFolder, (AreasList.SelectedItem as PreplannedMapArea).PortalItem.Title))) { DownloadButton.Content = "View downloaded area"; } else { DownloadButton.Content = "Download preplanned area"; } }
// Handle the spatial operation selection by performing the operation and showing the result polygon. private void SpatialOperationComboBox_SelectionChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e) { // If an operation hasn't been selected, return. if (SpatialOperationComboBox.SelectedItem == null) { return; } // Remove any currently displayed result. _polygonsOverlay.Graphics.Remove(_resultGraphic); // Polygon geometry from the input graphics. Geometry polygonOne = _graphicOne.Geometry; Geometry polygonTwo = _graphicTwo.Geometry; // Result polygon for spatial operations. Geometry resultPolygon = null; // Run the selected spatial operation on the polygon graphics and get the result geometry. string operation = (string)SpatialOperationComboBox.SelectedItem; switch (operation) { case "Union": resultPolygon = GeometryEngine.Union(polygonOne, polygonTwo); break; case "Difference": resultPolygon = GeometryEngine.Difference(polygonOne, polygonTwo); break; case "Symmetric difference": resultPolygon = GeometryEngine.SymmetricDifference(polygonOne, polygonTwo); break; case "Intersection": resultPolygon = GeometryEngine.Intersection(polygonOne, polygonTwo); break; } // Create a black outline symbol to use for the result polygon. SimpleLineSymbol outlineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.Black, 1); // Create a solid red fill symbol for the result polygon graphic. SimpleFillSymbol resultSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, System.Drawing.Color.Red, outlineSymbol); // Create the result polygon graphic and add it to the graphics overlay. _resultGraphic = new Graphic(resultPolygon, resultSymbol); _polygonsOverlay.Graphics.Add(_resultGraphic); }
/// <summary> /// Takes action once a new layer selection is made. /// </summary> private void ListSelectionChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e) { // Deselect removed layers. foreach (LayerDisplayVM item in e.RemovedItems) { item.Select(false); } // Select added layers. foreach (LayerDisplayVM item in e.AddedItems) { item.Select(); } // Update the map. UpdateMapDisplay(_viewModelList); }
private void StretchTypeComboBox_SelectionChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e) { // Hide all UI controls for the input parameters. MinMaxParametersGrid.Visibility = Microsoft.UI.Xaml.Visibility.Collapsed; PercentClipParametersGrid.Visibility = Microsoft.UI.Xaml.Visibility.Collapsed; StdDeviationParametersGrid.Visibility = Microsoft.UI.Xaml.Visibility.Collapsed; // See which type was selected and show the corresponding input controls. switch (StretchTypeComboBox.SelectedValue.ToString()) { case "Min Max": MinMaxParametersGrid.Visibility = Microsoft.UI.Xaml.Visibility.Visible; break; case "Percent Clip": PercentClipParametersGrid.Visibility = Microsoft.UI.Xaml.Visibility.Visible; break; case "Standard Deviation": StdDeviationParametersGrid.Visibility = Microsoft.UI.Xaml.Visibility.Visible; break; } }
private void ListView_SelectionChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e) { VirtualView?.OnSelected(0, NativeView.SelectedIndex); }
// Handle a new selected comment record in the table view. private async void CommentsListBox_SelectionChanged(object sender, Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs e) { // Clear selected features from the graphics overlay. _selectedFeaturesOverlay.Graphics.Clear(); // Get the selected comment feature. If there is no selection, return. ArcGISFeature selectedComment = e.AddedItems[0] as ArcGISFeature; if (selectedComment == null) { return; } // Get the map image layer that contains the service request sublayer and the service request comments table. ArcGISMapImageLayer serviceRequestsMapImageLayer = (ArcGISMapImageLayer)MyMapView.Map.OperationalLayers[0]; // Get the (non-spatial) table that contains the service request comments. ServiceFeatureTable commentsTable = serviceRequestsMapImageLayer.Tables[0]; // Get the relationship that defines related service request features for features in the comments table (this is the first and only relationship). RelationshipInfo commentsRelationshipInfo = commentsTable.LayerInfo.RelationshipInfos.FirstOrDefault(); // Create query parameters to get the related service request for features in the comments table. RelatedQueryParameters relatedQueryParams = new RelatedQueryParameters(commentsRelationshipInfo) { ReturnGeometry = true }; try { // Query the comments table to get the related service request feature for the selected comment. IReadOnlyList <RelatedFeatureQueryResult> relatedRequestsResult = await commentsTable.QueryRelatedFeaturesAsync(selectedComment, relatedQueryParams); // Get the first result. RelatedFeatureQueryResult result = relatedRequestsResult.FirstOrDefault(); // Get the first feature from the result. If it's null, warn the user and return. ArcGISFeature serviceRequestFeature = result.FirstOrDefault() as ArcGISFeature; if (serviceRequestFeature == null) { var message = new MessageDialog2("Related feature not found.", "No Feature"); await message.ShowAsync(); return; } // Load the related service request feature (so its geometry is available). await serviceRequestFeature.LoadAsync(); // Get the service request geometry (point). MapPoint serviceRequestPoint = serviceRequestFeature.Geometry as MapPoint; // Create a cyan marker symbol to display the related feature. Symbol selectedRequestSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Color.Cyan, 14); // Create a graphic using the service request point and marker symbol. Graphic requestGraphic = new Graphic(serviceRequestPoint, selectedRequestSymbol); // Add the graphic to the graphics overlay and zoom the map view to its extent. _selectedFeaturesOverlay.Graphics.Add(requestGraphic); await MyMapView.SetViewpointCenterAsync(serviceRequestPoint, 150000); } catch (Exception ex) { await new MessageDialog2(ex.ToString(), "Error").ShowAsync(); } }