<ResourceDictionary <Style x:Key="EditorWidgetStyle2" TargetType="esri:EditorWidget"> ... <Grid x:Name="ToolsContainer1" Background="{TemplateBinding Background}" HorizontalAlignment="Center" > <StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,0"> <!--SELECT BUTTON--> <Button x:Name="Select" Command="{Binding Select}" /> <!--CUSTOM BUTTON--> <Button x:Name="PavementPerformace" Height="40" Width="40"> <i:Interaction.Triggers > <i:EventTrigger EventName="Click"> <local:PavementPerformace/> </i:EventTrigger> </i:Interaction.Triggers> </Button> </StackPanel> </Grid> </Style> </ResourceDictionary>
public class PavementPerformace:TargetedTriggerAction<Button> { protected override void Invoke(object parameter){} protected override void OnAttached() { base.OnAttached(); Target.Click += new RoutedEventHandler(Target_Click); } void Target_Click(object sender, RoutedEventArgs e) { //Access selected feature and calculate pavement performance } protected override void OnDetaching() { base.OnDetaching(); Target.Click -= new RoutedEventHandler(Target_Click); } }
FeatureLayer layer = this.MyMap.Layers["LayerID"] as FeatureLayer; if (layer != null) foreach(Graphic g in layer.SelectedGraphics) { // Do what you need to do with each selected graphic. }
public MainPage() { InitializeComponent(); Editor editor = this.MyEditorWidget.DataContext as Editor; if (editor != null) editor.EditCompleted += editor_EditCompleted; } void editor_EditCompleted(object sender, Editor.EditEventArgs e) { if (e.Action == Editor.EditAction.Select) { foreach (var edit in e.Edits) { // Do what you need to do with edit.Graphic // (edit.Layer as FeatureLayer).SelectedGraphics also // gives you a list of all selected graphics in the specific layer } } }
<Button x:Name="MyButton" IsEnabled="True" Style="{StaticResource ButtonStyle}" Content="My New Button" Click="MyButton_Click" />
private void MyButton_Click(object sender, RoutedEventArgs e) { }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.