Select to view content in your preferred language

Info about FeatureLayer ( Selection on feature layer )

772
3
07-21-2010 11:45 AM
MarcoRosa
Emerging Contributor
Hi to all,
just one information .... referring on sample:

http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureLayerSelection

So, to do multiple selection is necessary to press keyboard button ..... it's possible to set this option by default and make directly multiple selection instead of press keyboard button each time ?
Better without the botton .... 🙂

Button code section is that:

               <Button x:Name="EnableKeyboardButton" Margin="2"
                            Content="Keyboard"
                            Command="{Binding Select}"
                            CommandParameter="Keyboard"
                            >
                    </Button>


many and many thaks ....
GP
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
The idea for using "Keyboard" as CommandParameter is to allow user to use a single button for Add to/Remove from selection using hot keys to distinguish the selection mode (Ctrl for Add, Shift for Remove). But if you do not want to use keyboard, you can simply do two buttons:

<Button x:Name="AddSelectButton" Content="Add" Command="{Binding Select}" CommandParameter="Add"/>

<Button x:Name="RemoveSelectButton" Content="Remove" Command="{Binding Select}"
CommandParameter="Remove"/>

Jennifer
0 Kudos
MarcoRosa
Emerging Contributor
hi jennifer , thanks for answer me.
I undestand the u mean, i agree with u of the behaviour ok keyboard button .... i mean only to do always the "keyboard pressed button behaviour" without have button ..... hope i was able to describe what i mean.
What i would like to have is .... add button to start selection ....and stop button to stop the selection and ( option ) to choose the selection mode.

See u ... thks again George
0 Kudos
JenniferNery
Esri Regular Contributor
If I understood your question correctly, you want to be able to add to/remove from selection without clicking on any button and only using your keyboard and mouse.

If that is the case, you can listen to KeyDown and pass the proper command parameter on the editor's Select command based on the pressed key.
 
        public MainPage()
        {
            InitializeComponent();
            this.KeyDown += new KeyEventHandler(MainPage_KeyDown);
            editor = this.LayoutRoot.Resources["MyEditor"] as Editor;
        }
        Editor editor;
        void MainPage_KeyDown(object sender, KeyEventArgs e)
        {
            if (editor == null) return;
            if (e.Key == Key.Ctrl)
                editor.Select.Execute("Add");
            else if (e.Key == Key.Shift)
                editor.Select.Execute("Remove");
            else if (e.Key == Key.Escape)            
                editor.CancelActive.Execute(null);
        }



Jennifer
0 Kudos