
C# | Visual Basic | Visual C++ |
public class App : Application
Public Class App _ Inherits Application
public ref class App : public Application

All Members | Constructors | Methods | Properties | Events | |
Icon | Member | Description |
---|---|---|
![]() | App()()() |
Instantiates a new App instance.
|
![]() | Equals(Object) | (Inherited from Object.) |
![]() | Exit | (Inherited from Application.) |
![]() | GetHashCode()()() |
Serves as a hash function for a particular type.
(Inherited from Object.) |
![]() | GetType()()() |
Gets the Type of the current instance.
(Inherited from Object.) |
![]() | Host()()() | (Inherited from Application.) |
![]() | InitializeComponent()()() |
InitializeComponent
|
![]() | Resources | (Inherited from Application.) |
![]() | RootVisual()()() | (Inherited from Application.) |
![]() | Startup | (Inherited from Application.) |
![]() | ToString()()() | (Inherited from Object.) |
![]() | UnhandledException()()() | (Inherited from Application.) |

The Microsoft Bing SDK is very easy to use in terms of Xaml implementation and binding to the Search data itself. The SearchEnvironment singleton is where the bulk of the logic and data operations take place. This object is also a DependencyObject and implements INotifyPropertyChanged, which provides support for data binding.
To execute a search, you only need to create a SearchRequest, populate its Query property, and then insure that you have set the SearchMedia property on the SearchEnvironment. Then, call the method BeginSearch(String), insuring that you have provided a handler for SearchCompleted.
You should also bind any display controls - typically ItemsControl instances, such as ListBox etc - to the Results property. This property is of type SearchResults and is an observable collection. This means that you can data bind your ItemsControl instances in advance, like this:

//Assumes a ItemsControl named "MyList" exists... MyList.ItemsSource = SearchEnvironment.Default.Results; //Consume SearchEnvironment Events SearchEnvironment.Default.SearchStarted += new EventHandler(OnSearchStarted); SearchEnvironment.Default.SearchCompleted += new EventHandler<SearchResponseEventArgs>(OnSearchCompleted); SearchEnvironment.Default.Error += new EventHandler<ErrorEventArgs>(OnSearchError); //Begin the Search (Assume a TextBox named "QueryText" exists) SearchEnvironment.Default.PageSize = 20; SearchEnvironment.Default.MediaType = SearchMedia.Web; SearchEnvironment.Default.BeginSearch(QueryText.Text);
This should be done prior to executing any searches. Then when a search completes, the Results collection will become populated, if there are avialable results, and your ItemsControl control will automatically data bind and use the asynchronous layout framework in the Silverlight runtime.

