Silverlight SDK for Microsoft Bing
Page Class
OverviewMicrosoft.Bing.ApplicationPage
Implements a stock UserControl to demonstrate and serve as working implementation for the Microsoft Bing Search API and the Microsoft Silverlight SDK for Bing
Declaration Syntax
C#Visual BasicVisual C++
public class Page : UserControl
Public Class Page _
	Inherits UserControl
public ref class Page : public UserControl
Members
All MembersConstructorsMethodsPropertiesEvents



IconMemberDescription
Page()()()
Instantiates a new Page instance.

ActualHeight (Inherited from FrameworkElement.)
ActualWidth (Inherited from FrameworkElement.)
ApplyTemplate()()() (Inherited from Control.)
Arrange(Rect) (Inherited from UIElement.)
Background (Inherited from Control.)
BindingValidationError()()() (Inherited from FrameworkElement.)
BorderBrush (Inherited from Control.)
BorderThickness (Inherited from Control.)
CaptureMouse()()() (Inherited from UIElement.)
CheckAccess()()() (Inherited from DependencyObject.)
ClearValue(DependencyProperty) (Inherited from DependencyObject.)
Clip (Inherited from UIElement.)
Cursor (Inherited from FrameworkElement.)
DataContext (Inherited from FrameworkElement.)
DesiredSize (Inherited from UIElement.)
Dispatcher()()() (Inherited from DependencyObject.)
Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
FindName(String) (Inherited from FrameworkElement.)
Focus()()() (Inherited from Control.)
FontFamily (Inherited from Control.)
FontSize (Inherited from Control.)
FontStretch (Inherited from Control.)
FontStyle (Inherited from Control.)
FontWeight (Inherited from Control.)
Foreground (Inherited from Control.)
GetAnimationBaseValue(DependencyProperty) (Inherited from DependencyObject.)
GetHashCode()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetType()()()
Gets the Type of the current instance.
(Inherited from Object.)
GetValue(DependencyProperty) (Inherited from DependencyObject.)
GotFocus (Inherited from UIElement.)
Height (Inherited from FrameworkElement.)
HorizontalAlignment (Inherited from FrameworkElement.)
HorizontalContentAlignment (Inherited from Control.)
InitializeComponent()()()
InitializeComponent

InvalidateArrange()()() (Inherited from UIElement.)
InvalidateMeasure()()() (Inherited from UIElement.)
IsEnabled()()() (Inherited from Control.)
IsEnabledChanged()()() (Inherited from Control.)
IsHitTestVisible (Inherited from UIElement.)
IsTabStop (Inherited from Control.)
KeyDown (Inherited from UIElement.)
KeyUp (Inherited from UIElement.)
Language (Inherited from FrameworkElement.)
LayoutUpdated()()() (Inherited from FrameworkElement.)
Loaded (Inherited from FrameworkElement.)
LostFocus (Inherited from UIElement.)
LostMouseCapture (Inherited from UIElement.)
Margin (Inherited from FrameworkElement.)
MaxHeight (Inherited from FrameworkElement.)
MaxWidth (Inherited from FrameworkElement.)
Measure(Size) (Inherited from UIElement.)
MinHeight (Inherited from FrameworkElement.)
MinWidth (Inherited from FrameworkElement.)
MouseEnter (Inherited from UIElement.)
MouseLeave (Inherited from UIElement.)
MouseLeftButtonDown (Inherited from UIElement.)
MouseLeftButtonUp (Inherited from UIElement.)
MouseMove (Inherited from UIElement.)
Name (Inherited from FrameworkElement.)
OnApplyTemplate()()() (Inherited from FrameworkElement.)
Opacity (Inherited from UIElement.)
OpacityMask (Inherited from UIElement.)
Padding (Inherited from Control.)
Parent (Inherited from FrameworkElement.)
ReadLocalValue(DependencyProperty) (Inherited from DependencyObject.)
ReleaseMouseCapture()()() (Inherited from UIElement.)
RenderSize (Inherited from UIElement.)
RenderTransform (Inherited from UIElement.)
RenderTransformOrigin (Inherited from UIElement.)
Resources (Inherited from FrameworkElement.)
SetBinding(DependencyProperty, Binding) (Inherited from FrameworkElement.)
SetValue(DependencyProperty, Object) (Inherited from DependencyObject.)
SizeChanged (Inherited from FrameworkElement.)
Style (Inherited from FrameworkElement.)
TabIndex (Inherited from Control.)
TabNavigation()()() (Inherited from Control.)
Tag (Inherited from FrameworkElement.)
Template (Inherited from Control.)
ToString()()()
Returns a String that represents the current Object.
(Inherited from Object.)
TransformToVisual(UIElement) (Inherited from UIElement.)
Triggers (Inherited from FrameworkElement.)
UpdateLayout()()() (Inherited from UIElement.)
UseLayoutRounding()()() (Inherited from UIElement.)
VerticalAlignment (Inherited from FrameworkElement.)
VerticalContentAlignment (Inherited from Control.)
Visibility (Inherited from UIElement.)
Width (Inherited from FrameworkElement.)
Examples

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:

CopyC#
//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.

Inheritance Hierarchy
See Also

Assembly: Microsoft.Bing.Application (Module: Microsoft.Bing.Application) Version: 1.0.0.0 (1.0.0.0)