Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WebBrowserBrush Class


Provides a brush that renders the currently hosted HTML.


Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

public sealed class WebBrowserBrush : TileBrush
<WebBrowserBrush .../>

The WebBrowserBrush type exposes the following members.

Public methodWebBrowserBrushInitializes a new instance of the WebBrowserBrush class.

Public propertyAlignmentXGets or sets the horizontal alignment of content in the TileBrush base tile. (Inherited from TileBrush.)
Public propertyAlignmentYGets or sets the vertical alignment of content in the TileBrush base tile. (Inherited from TileBrush.)
Public propertyDispatcherGets the Dispatcher this object is associated with. (Inherited from DependencyObject.)
Public propertyOpacityGets or sets the degree of opacity of a Brush. (Inherited from Brush.)
Public propertyRelativeTransformGets or sets the transformation that is applied to the brush using relative coordinates. (Inherited from Brush.)
Public propertySourceNameGets the name of the source WebBrowser control that provides the HTML content.
Public propertyStretchGets or sets a value that specifies how the content of this TileBrush stretches to fit its tiles. (Inherited from TileBrush.)
Public propertyTransformGets or sets the transformation that is applied to the brush. (Inherited from Brush.)

Public methodCheckAccessDetermines whether the calling thread has access to this object. (Inherited from DependencyObject.)
Public methodClearValueClears the local value of a dependency property. (Inherited from DependencyObject.)
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetAnimationBaseValueReturns any base value established for a Silverlight dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetValueReturns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodReadLocalValueReturns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.)
Public methodRedrawForces the brush to asynchronously redraw itself.
Public methodSetSourceSets the source of the content for the WebBrowserBrush.
Public methodSetValueSets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Public fieldStatic memberSourceNamePropertyIdentifies the SourceName dependency property.

WebBrowserBrush is a type of Brush object similar to a VideoBrush. However, instead of painting an area with video content, it paints an area with HTML content. This HTML content is provided by a WebBrowser control. Just like the other brush types, you can use a WebBrowserBrush to paint the following:


You can only use WebBrowserBrush in a Silverlight 4 or later out-of-browser application or in a Silverlight 5 in-browser trusted application.

To use a WebBrowserBrush, you do the following:

  1. Create a WebBrowser control and set its Source property.

  2. Apply the WebBrowserBrush to the object that you want to paint.

  3. Set the WebBrowserBrush object's SourceName property to the name of the WebBrowser that you created.

If the content in the WebBrowser changes, you must call the Redraw method to update the WebBrowserBrush.

WebBrowserBrush can only be used in applications that run outside the browser. If you use it in an application that runs in the browser, WebBrowserBrush is transparent and does not contain placeholder content.

The following example shows how to use a WebBrowserBrush control. In this example, the WebBrowserBrush updates its content when the user moves the mouse.

private void LayoutRoot_MouseMove(object sender, MouseEventArgs e)

<StackPanel x:Name="LayoutRoot" Background="Blue" MouseMove="LayoutRoot_MouseMove">
    <WebBrowser Name="WB1" Source="Hello.html" Height="150" Width="150" />
    <Rectangle Height="150" Width="150" >
            <WebBrowserBrush SourceName="WB1" Opacity=".5" x:Name="WBB1"/>


Supported in: 5, 4

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

© 2017 Microsoft