Select to view content in your preferred language

Adding a Search Box and Button

612
2
Jump to solution
04-03-2012 01:31 PM
TomFlahive
Occasional Contributor
I am looking for some general guidance on how to accomplish something with the Silverlight Viewer.  We would like to be able to add a text box and button to the top of some of our Silverlight Viewer Applications to perform various searches.  So, for example, that search box might be used to search certain fields on a Parcel layer or a roads layer, or it might be used to allow the user to enter lat long coordinates to search, or to search a service layer.  I???m trying to figure out the best approach for doing this.  Here are my current ideas:

--Create a custom layout with the search text box and button already in the layout (on the top bar), but with no functionality.  Add functionality to that search box and button by creating add-in map behaviors that would link to that search box and button (don't know if this would work). 

So if you wanted to search a particular layer on the map, you could add in a behavior that allowed you to configure which layer and which attribute field to search.  If you wanted to add additional layers to search, you would just add additional map behaviors that are configured for the additional layers, or whatever additional search features you wanted to add.  Hitting the search button would run through all of the map behaviors associated with that search box.

--Create the search text box and button as a tool Add-In so that you can add it only when you need it and to any layout you want (don???t know if this can be done as a Tool add-in).  Then add the actual search functionality either as part of the tool add-in or as a map behavior add-in.

Will either of these scenarios work?  Any ideas would be appreciated.

Tom
0 Kudos
1 Solution

Accepted Solutions
KatherineDalton
Esri Regular Contributor
Hi Tom,

Here's a short bit of direction from Rich Z. on our team. Maybe others in the community have ideas too!

You won't be able to embed the textbox in the application as a tool. If you are OK with a tool that opens a window containing the search textbox, then that???s definitely the way to go. As far as wiring up the functionality, use either ISupportsConfiguration or ISupportsWizardConfiguration to allow configuration of the options wanted (e.g. the layer(s) to search).

If you absolutely have to have the search textbox embedded at the top of the application, then a custom control embedded in a custom layout is the way to go. Implement ISupportsConfiguration to expose the configuration options you want. I???ve actually done something similar with the Configurable" rel="nofollow" target="_blank">http://www.arcgis.com/home/item.html?id=b7ed00317660465... Description sample I posted last Friday on the code gallery. That would be a good starting place.

Tom - hope that helps,
Katy
Katy Dalton | Technical Consultant
THE SCIENCE OF WHERE™

View solution in original post

0 Kudos
2 Replies
KatherineDalton
Esri Regular Contributor
Hi Tom,

Here's a short bit of direction from Rich Z. on our team. Maybe others in the community have ideas too!

You won't be able to embed the textbox in the application as a tool. If you are OK with a tool that opens a window containing the search textbox, then that???s definitely the way to go. As far as wiring up the functionality, use either ISupportsConfiguration or ISupportsWizardConfiguration to allow configuration of the options wanted (e.g. the layer(s) to search).

If you absolutely have to have the search textbox embedded at the top of the application, then a custom control embedded in a custom layout is the way to go. Implement ISupportsConfiguration to expose the configuration options you want. I???ve actually done something similar with the Configurable" rel="nofollow" target="_blank">http://www.arcgis.com/home/item.html?id=b7ed00317660465... Description sample I posted last Friday on the code gallery. That would be a good starting place.

Tom - hope that helps,
Katy
Katy Dalton | Technical Consultant
THE SCIENCE OF WHERE™
0 Kudos
TomFlahive
Occasional Contributor
Thanks Katy,

I looked at your example Configurable Description and can see how that might work.  But I think your first approach might be the better way to go--having a tool that opens up a search dialog box.  I had a couple of follow up questions on that approach.

So there is already a Search tool available for the Viewer.  Is it possible to intercept the text from that search tool to do my own search, and bypass the default searches that come with that tool (so in other words, customize that existing search tool)?  If that is not possible, it would be good to be able to create something as similar to that as possible.  Is there any code available for a similar window?  Also, I noticed the Search panel shares the same space as the Map Contents list (resizing the width of one, resizes the other).  Is it possible to create a custom dialog for a tool that also shares this same space?  I�??m just not clear how you reference that space that is shared by the Search and the Map Contents dialog boxes.

Thanks.

Tom
0 Kudos