WebViewBrush 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
public ref class WebViewBrush sealed : TileBrush
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class WebViewBrush final : TileBrush
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class WebViewBrush final : TileBrush
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class WebViewBrush : TileBrush
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class WebViewBrush : TileBrush
Public NotInheritable Class WebViewBrush
Inherits TileBrush
<WebViewBrush .../>
- 상속
- 특성
Windows 요구 사항
| 디바이스 패밀리 |
Windows 10 (10.0.10240.0에서 도입되었습니다.)
|
| API contract |
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)
|
예제
다음 Windows 8개 관련 코드 예제에서는 WebViewBrush를 사용하여 XAML 기반 콘텐츠가 HTML 기반 콘텐츠와 겹칠 수 있도록 하는 방법을 보여 줍니다. 이 예제에서는 컨트롤이 WebView 대화형으로 유지되도록 기본적으로 표시됩니다. ComboBox 그러나 드롭다운 목록이 열려 있으면 컨트롤과 WebView 겹칩니다. 이 경우 WebView 숨겨지고 WebViewBrush는 동일한 공간을 차지하는 HTML 콘텐츠를 Rectangle 표시합니다.
<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 SDKSample::WebViewControl::Scenario6::ComboBox1_DropDownOpened(
Platform::Object^ sender, Platform::Object^ e)
{
if (Rect1->Visibility == Windows::UI::Xaml::Visibility::Visible)
{
WebViewBrush^ b = ref new WebViewBrush();
b->SourceName = "WebView6";
b->Redraw();
Rect1->Fill = b;
WebView6->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
}
}
void SDKSample::WebViewControl::Scenario6::ComboBox1_DropDownClosed(
Platform::Object^ sender, Platform::Object^ e)
{
WebView6->Visibility = Windows::UI::Xaml::Visibility::Visible;
Rect1->Fill = ref new SolidColorBrush(Windows::UI::Colors::Transparent);
}
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);
}
Private Sub ComboBox1_DropDownOpened(sender As Object, e As Object)
If Rect1.Visibility = Windows.UI.Xaml.Visibility.Visible Then
Dim b As New WebViewBrush()
b.SourceName = "WebView6"
b.Redraw()
Rect1.Fill = b
WebView6.Visibility = Windows.UI.Xaml.Visibility.Collapsed
End If
End Sub
Private Sub ComboBox1_DropDownClosed(sender As Object, e As Object)
WebView6.Visibility = Windows.UI.Xaml.Visibility.Visible
Rect1.Fill = New SolidColorBrush(Windows.UI.Colors.Transparent)
End Sub
설명
Windows 8 WebView 에서는 컨트롤과 같은 다른 UI 영역을 위에 렌더링할 수 없는 특징이 있습니다. 이는 창 영역이 내부적으로 처리되는 방식, 특히 입력 이벤트가 처리되는 방법 및 화면 그리기 방식 때문입니다. HTML 콘텐츠를 렌더링하고 다른 UI 요소를 해당 HTML 콘텐츠 위에 배치하려면 WebViewBrush를 렌더링 영역으로 사용해야 합니다. 여전히 WebView HTML 원본 정보를 제공하며 WebView 속성을 통해 참조합니다(또는 호출SetSource을 통해 SourceName 메서드와 속성이 동일한 결과를 생성). WebViewBrush에는 이 오버레이 제한이 없지만 상호 작용을 사용하도록 설정하지는 않습니다.
참고
앞의 설명은 Windows 8.1에서 실행되는 경우에도 Windows 8용으로 컴파일된 앱에만 적용됩니다. Windows 8.1에서는 여기에 설명된 문제를 해결하는 컨트롤이 변경 WebView 되었습니다. Windows 8.1의 경우 WebViewBrush를 계속 사용하는 시나리오는 일반화되지 않을 것으로 예상됩니다. 대부분의 경우 컨트롤을 WebView 사용하고 필요한 기능을 가져올 수 있습니다.
를 사용하는 모든 속성에 WebViewBrush를 적용할 수 있습니다 Brush. 예를 들어 WebViewBrush를 설정 Shape.Fill 하거나 Control.Background 사용할 수 있습니다.
WebViewBrush를 제어 원본과 연결하기 위한 두 가지 대안이 WebView 있습니다.
- 속성을 설정하여 식별자 이름으로 원본 WebView 을 참조합니다 SourceName .
- 메서드를 호출 SetSource 하고 개체를 전달하여 참조로 소스를 WebView 참조합니다WebView.
중요
원본과 동일한 UI에서 XAML로 선언된 WebViewBrush를 호출 Redraw 해야 하는 경우가 WebView 많습니다. WebView 컨트롤에는 콘텐츠가 완전히 로드될 때 컨트롤을 다시 그리는 본질적으로 비동기 동작이 있습니다. 그러나 연결된 WebViewBrush는 XAML이 구문 분석되는 즉시 렌더링됩니다(URI 콘텐츠가 로드 WebView되기 전일 수 있습니다). 또는 원본 콘텐츠가 완전히 로드될 때까지 WebViewBrush에서 호출 SetSource 할 때까지 기다릴 수 있습니다(예: 이벤트에 대한 WebView.LoadCompleted 처리기에서 호출SetSource).
이 클래스는 Windows Phone 8.x에서 지원되지 않습니다. WebView 콘텐츠는 캡처되지 않습니다.
생성자
| WebViewBrush() |
WebViewBrush 클래스의 새 인스턴스를 초기화합니다. |
속성
메서드
적용 대상
추가 정보
피드백
다음에 대한 사용자 의견 제출 및 보기