Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

WebBrowserBrush.SourceName Property

Silverlight

Gets the name of the source WebBrowser control that provides the HTML content.

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

public string SourceName { get; set; }
<WebBrowserBrush SourceName="webBrowserName"/>

Property Value

Type: System.String
The Name of the WebBrowser that provides the HTML content.

You must set a name for the WebBrowser control, either in XAML or code prior to setting the SourceName property.

The following example shows how set the SourceName property of a WebBrowserBrush control.


    <UserControl x:Class="WebBrowserBrushEx.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="400" d:DesignWidth="412">
    <Grid x:Name="LayoutRoot" Background="LightBlue" MouseMove="LayoutRoot_MouseMove" ShowGridLines="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="40"/>
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid.Resources>
            <Storyboard x:Name="Spin" >
                <DoubleAnimation
                        Storyboard.TargetName="myTransform"
                        Storyboard.TargetProperty="Angle"
                        From="0" To="360" Duration="0:0:5" 
                        RepeatBehavior="Forever" />
            </Storyboard>
        </Grid.Resources>
        <TextBlock Margin="5" Text="Right-click to install the out-of-browser application" />
        <WebBrowser Grid.Row="1" Visibility="Visible" Name="WB1" Height="350" Width="350" Source="http://www.bing.com"  />

        <!-- Add Rectangle the same size as the WebBrowser control -->
        <Rectangle Grid.Row="1" x:Name="brush" Width="350" Height="350"  Visibility="Collapsed" 
                   MouseLeftButtonDown="brush_MouseLeftButtonDown"  >
            <Rectangle.Fill>
                <!-- Fill (set background) as an HTML Brush -->
                <WebBrowserBrush x:Name="htmlBrush" SourceName="WB1"/>
            </Rectangle.Fill>
            <Rectangle.RenderTransform>
                <RotateTransform x:Name="myTransform" Angle="45" CenterX="175" CenterY="175" />
            </Rectangle.RenderTransform>

        </Rectangle>
     </Grid>
</UserControl>


Silverlight

Supported in: 5, 4

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

Community Additions

ADD
Show:
© 2015 Microsoft