WebViewBrush class

5 out of 5 rated this helpful - Rate this topic

Provides a brush that renders the content that is currently hosted in a WebView control.

Inheritance

Object
  DependencyObject
    Brush
      TileBrush
        WebViewBrush

Syntax


public sealed class WebViewBrush : TileBrush


<WebViewBrush .../>

Attributes

ActivatableAttribute(NTDDI_WIN8)
MarshalingBehaviorAttribute(Agile)
StaticAttribute(Windows.UI.Xaml.Controls.IWebViewBrushStatics, NTDDI_WIN8)
ThreadingAttribute(Both)
VersionAttribute(NTDDI_WIN8)
WebHostHiddenAttribute()

Members

The WebViewBrush class has these types of members:

Constructors

The WebViewBrush class has these constructors.

ConstructorDescription
WebViewBrush Initializes a new instance of the WebViewBrush class.

 

Methods

The WebViewBrush class has these methods. It also inherits methods from the Object class.

MethodDescription
ClearValue Clears the local value of a dependency property. (Inherited from DependencyObject)
GetAnimationBaseValue Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject)
GetValue Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject)
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 WebViewBrush.
SetValue Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject)

 

Properties

The WebViewBrush class has these properties.

PropertyAccess typeDescription

AlignmentX

Read/writeGets or sets the horizontal alignment of content in the TileBrush base tile. (Inherited from TileBrush)

AlignmentY

Read/writeGets or sets the vertical alignment of content in the TileBrush base tile. (Inherited from TileBrush)

Dispatcher

Read-onlyGets the CoreDispatcher that this object is associated with. (Inherited from DependencyObject)

Opacity

Read/writeGets or sets the degree of opacity of a Brush. (Inherited from Brush)

RelativeTransform

Read/writeGets or sets the transformation that is applied to the brush using relative coordinates. (Inherited from Brush)

SourceName

Read/writeGets or sets the name of the source WebView control that provides the HTML content.

SourceNameProperty

Read-onlyIdentifies the SourceName dependency property.

Stretch

Read/writeGets or sets a value that specifies how the content of this TileBrush stretches to fit its tiles. (Inherited from TileBrush)

Transform

Read/writeGets or sets the transformation that is applied to the brush. (Inherited from Brush)

 

Remarks

WebView has the characteristic that other UI regions such as controls cannot be rendered on top of the WebView. This is because of how window regions are handled internally, particularly how input events are processed and how the screen draws. If you want to render HTML content and also place other UI elements on top of that HTML content, you should use WebViewBrush as the render area. The WebView still provides the HTML source information, and you reference that WebView through the SourceName property. WebViewBrush does not have this overlay limitation, but it doesn't enable interaction.

Examples

The following code example demonstrates how to use a WebViewBrush to enable XAML-based content to overlap HTML-based content. In this example, the WebView control is displayed by default so that it remains interactive. When the ComboBox drop-down list is open, however, it overlaps the WebView control. In this case, the WebView is hidden and the WebViewBrush displays the HTML content on a Rectangle occupying the same space.

For the complete code listing, see the XAML WebView control sample.


<Grid x:Name="Output" Grid.Row="1">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <ComboBox x:Name="ComboBox1" Height="50" Width="200" HorizontalAlignment="Left" Margin="10,0,0,0">
        <ComboBoxItem>
            <x:String>First Item</x:String>
        </ComboBoxItem>
        <ComboBoxItem>
            <x:String>Second Item</x:String>
        </ComboBoxItem>
        <ComboBoxItem>
            <x:String>Third Item</x:String>
        </ComboBoxItem>
        <ComboBoxItem>
            <x:String>Fourth Item</x:String>
        </ComboBoxItem>
        <ComboBoxItem>
            <x:String>Fifth Item</x:String>
        </ComboBoxItem>
        <ComboBoxItem>
            <x:String>Sixth Item</x:String>
        </ComboBoxItem>
        <ComboBoxItem>
            <x:String>Seventh Item</x:String>
        </ComboBoxItem>
    </ComboBox>
    <Border BorderThickness="1" BorderBrush="#FF707070"  Grid.Row="1" Margin="10,0,0,0">
        <Grid>
            <WebView x:Name="WebView6" />
            <Rectangle x:Name="Rect1"/>
        </Grid>
    </Border>
</Grid>



void ComboBox1_DropDownOpened(object sender, object e)
{
    if (Rect1.Visibility == Windows.UI.Xaml.Visibility.Visible)
    {
        WebViewBrush b = new WebViewBrush();
        b.SourceName = "WebView6";
        b.Redraw();
        Rect1.Fill = b;
        WebView6.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
    }
}

void ComboBox1_DropDownClosed(object sender, object e)
{
    WebView6.Visibility = Windows.UI.Xaml.Visibility.Visible;
    Rect1.Fill = new SolidColorBrush(Windows.UI.Colors.Transparent);
}


Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

See also

TileBrush

 

 

Build date: 3/12/2013

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.