WebBrowserBrush Class
Provides a brush that renders the currently hosted HTML.
System.Windows.DependencyObject
System.Windows.Media.Brush
System.Windows.Media.TileBrush
System.Windows.Controls.WebBrowserBrush
Namespace: System.Windows.Controls
Assembly: System.Windows (in System.Windows.dll)
The WebBrowserBrush type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | AlignmentX | Gets or sets the horizontal alignment of content in the TileBrush base tile. (Inherited from TileBrush.) |
![]() | AlignmentY | Gets or sets the vertical alignment of content in the TileBrush base tile. (Inherited from TileBrush.) |
![]() | Dispatcher | Gets the Dispatcher this object is associated with. (Inherited from DependencyObject.) |
![]() | Opacity | Gets or sets the degree of opacity of a Brush. (Inherited from Brush.) |
![]() | RelativeTransform | Gets or sets the transformation that is applied to the brush using relative coordinates. (Inherited from Brush.) |
![]() | SourceName | Gets the name of the source WebBrowser control that provides the HTML content. |
![]() | Stretch | Gets or sets a value that specifies how the content of this TileBrush stretches to fit its tiles. (Inherited from TileBrush.) |
![]() | Transform | Gets or sets the transformation that is applied to the brush. (Inherited from Brush.) |
| Name | Description | |
|---|---|---|
![]() | CheckAccess | Determines whether the calling thread has access to this object. (Inherited from DependencyObject.) |
![]() | ClearValue | Clears the local value of a dependency property. (Inherited from DependencyObject.) |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetAnimationBaseValue | Returns any base value established for a Silverlight dependency property, which would apply in cases where an animation is not active. (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 | Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ReadLocalValue | Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.) |
![]() | Redraw | Forces the brush to asynchronously redraw itself. |
![]() | SetSource | Sets the source of the content for the WebBrowserBrush. |
![]() | SetValue | Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
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:
The geometry contents of a Path.
The Background of a Canvas.
The Foreground of a TextBlock.
Note: |
|---|
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:
Create a WebBrowser control and set its Source property.
Apply the WebBrowserBrush to the object that you want to paint.
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 Sub LayoutRoot_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Input.MouseEventArgs) WBB1.Redraw() End Sub
<StackPanel x:Name="LayoutRoot" Background="Blue" MouseMove="LayoutRoot_MouseMove"> <WebBrowser Name="WB1" Source="Hello.html" Height="150" Width="150" /> <Rectangle Height="150" Width="150" > <Rectangle.Fill> <WebBrowserBrush SourceName="WB1" Opacity=".5" x:Name="WBB1"/> </Rectangle.Fill> </Rectangle> </StackPanel>
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.





Note: