When tabbing on map, I can see the focus (dotted rectangle) moves between areas. I want to implement an event handler to handle key down event so that when I tab thru states for instance, and hit Ctrl + Space, I select that graphic. How do I get the gragphic for that focused area?
Thanks!
I don't think this is possible, unless your symbol template includes controls. TabIndex is a property of Control. Shapes, like Rectangle, do not have this property.
You can try this SDK sample: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ElementLayer. Notice that even in an Element layer, you can only tab through some features (button and textbox).
Oh you must be using WPF! It was the only way I could get the graphics to get focus through tab event. Unfortunately, this seems to be a bug. The graphics should not be receiving focus through tab event. This might be something that needs to go away in the future.
Yes, I'm using WPF.
OK, it's good to know the answer so that we decide what to do.
Thanks again!
<StackPanel> <StackPanel.Resources> <ControlTemplate x:Key="MyEllipse" TargetType="{x:Type Control}"> <Ellipse Height="50" Width="50" Fill="Red"/> </ControlTemplate> <ControlTemplate x:Key="MyRectangle" TargetType="{x:Type Control}"> <Rectangle Height="50" Width="50" Fill="Blue"/> </ControlTemplate> </StackPanel.Resources> <Button Content="My Button"/> <ListBox> <ListBox.Items> <sys:String>item 1</sys:String> <sys:String>item 2</sys:String> <sys:String>item 3</sys:String> </ListBox.Items> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding}"/> </DataTemplate> </ListBox.ItemTemplate> </ListBox> <Control Template="{StaticResource MyEllipse}"/> <Control Template="{StaticResource MyRectangle}"/> </StackPanel>
I actually showed this to our Dev Lead yesterday and he thinks it's a bug. While you seem to be able to navigate through the graphics through tabbing or CTRL + Arrow keys, you are only getting the graphic element which is a control that is associated to the graphic.
To demonstrate that this tab property is inherited from Control. You can try the following sample in your WPF application. Notice that you can tab through control items unless you set their IsTabStop to false.<StackPanel> <StackPanel.Resources> <ControlTemplate x:Key="MyEllipse" TargetType="{x:Type Control}"> <Ellipse Height="50" Width="50" Fill="Red"/> </ControlTemplate> <ControlTemplate x:Key="MyRectangle" TargetType="{x:Type Control}"> <Rectangle Height="50" Width="50" Fill="Blue"/> </ControlTemplate> </StackPanel.Resources> <Button Content="My Button"/> <ListBox> <ListBox.Items> <sys:String>item 1</sys:String> <sys:String>item 2</sys:String> <sys:String>item 3</sys:String> </ListBox.Items> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding}"/> </DataTemplate> </ListBox.ItemTemplate> </ListBox> <Control Template="{StaticResource MyEllipse}"/> <Control Template="{StaticResource MyRectangle}"/> </StackPanel>