WebView Class

앱에서 HTML 콘텐츠를 호스팅하는 컨트롤을 제공합니다.

상속

Object
  DependencyObject
    UIElement
      FrameworkElement
        WebView

구문


public sealed class WebView : FrameworkElement

특성

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]
[WebHostHidden()]

멤버

WebView클래스에는 다음과 같은 형식의 멤버가 있습니다.

생성자

WebView클래스에는 다음과 같은 생성자가 있습니다.

생성자Description
WebView Initializes a new instance of the WebView class.

 

이벤트

WebView클래스에는 다음과 같은 이벤트가 있습니다.

이벤트Description
ContentLoading Occurs when the WebView has started loading new content.
DataContextChanged Occurs when the value of the FrameworkElement.DataContext property changes. (다음에서 상속됨 FrameworkElement)
DOMContentLoaded Occurs when the WebView has finished parsing the current HTML content.
DoubleTapped (not supported; see Remarks) Occurs when an otherwise unhandled DoubleTap interaction occurs over the hit test area of this element. (다음에서 상속됨 UIElement)
DragEnter (not supported; see Remarks) Occurs when the input system reports an underlying drag event with this element as the target. (다음에서 상속됨 UIElement)
DragLeave (not supported; see Remarks) Occurs when the input system reports an underlying drag event with this element as the origin. (다음에서 상속됨 UIElement)
DragOver (not supported; see Remarks) Occurs when the input system reports an underlying drag event with this element as the potential drop target. (다음에서 상속됨 UIElement)
Drop (not supported; see Remarks) Occurs when the input system reports an underlying drop event with this element as the drop target. (다음에서 상속됨 UIElement)
FrameContentLoading Occurs when a frame in the WebView has started loading new content.
FrameDOMContentLoaded Occurs when a frame in the WebView has finished parsing its current HTML content.
FrameNavigationCompleted Occurs when a frame in the WebView has finished loading its content.
FrameNavigationStarting Occurs before a frame in the WebView navigates to new content.
GotFocus Occurs when a UIElement receives focus. (다음에서 상속됨 UIElement)
Holding (not supported; see Remarks) Occurs when an otherwise unhandled Hold interaction occurs over the hit test area of this element. (다음에서 상속됨 UIElement)
KeyDown (not supported; see Remarks) Occurs when a keyboard key is pressed while the UIElement has focus. (다음에서 상속됨 UIElement)
KeyUp (not supported; see Remarks) Occurs when a keyboard key is released while the UIElement has focus. (다음에서 상속됨 UIElement)
LayoutUpdated Occurs when the layout of the visual tree changes, due to layout-relevant properties changing value or some other action that refreshes the layout. (다음에서 상속됨 FrameworkElement)
LoadCompleted Occurs when top-level navigation completes and the content loads into the WebView control or when an error occurs during loading.
Loaded Occurs when a FrameworkElement has been constructed and added to the object tree, and is ready for interaction. (다음에서 상속됨 FrameworkElement)
LongRunningScriptDetected Occurs periodically while the WebView executes JavaScript, letting you halt the script.
LostFocus Occurs when a UIElement loses focus. (다음에서 상속됨 UIElement)
ManipulationCompleted (not supported; see Remarks) Occurs when a manipulation on the UIElement is complete. (다음에서 상속됨 UIElement)
ManipulationDelta (not supported; see Remarks) Occurs when the input device changes position during a manipulation. (다음에서 상속됨 UIElement)
ManipulationInertiaStarting (not supported; see Remarks) Occurs when the input device loses contact with the UIElement object during a manipulation and inertia begins. (다음에서 상속됨 UIElement)
ManipulationStarted (not supported; see Remarks) Occurs when an input device begins a manipulation on the UIElement. (다음에서 상속됨 UIElement)
ManipulationStarting (not supported; see Remarks) Occurs when the manipulation processor is first created. (다음에서 상속됨 UIElement)
NavigationCompleted Occurs when the WebView has finished loading the current content or if navigation has failed.
NavigationFailed Occurs when the WebView cannot complete the navigation attempt.
NavigationStarting Occurs before the WebView navigates to new content.
PointerCanceled (not supported; see Remarks) Occurs when a pointer that made contact abnormally loses contact. (다음에서 상속됨 UIElement)
PointerCaptureLost (not supported; see Remarks) Occurs when pointer capture previously held by this element moves to another element or elsewhere. (다음에서 상속됨 UIElement)
PointerEntered (not supported; see Remarks) Occurs when a pointer enters the hit test area of this element. (다음에서 상속됨 UIElement)
PointerExited (not supported; see Remarks) Occurs when a pointer leaves the hit test area of this element. (다음에서 상속됨 UIElement)
PointerMoved (not supported; see Remarks) Occurs when a pointer moves while the pointer remains within the hit test area of this element. (다음에서 상속됨 UIElement)
PointerPressed (not supported; see Remarks) Occurs when the pointer device initiates a Press action within this element. (다음에서 상속됨 UIElement)
PointerReleased (not supported; see Remarks) Occurs when the pointer device that previously initiated a Press action is released, while within this element. (다음에서 상속됨 UIElement)
PointerWheelChanged (not supported; see Remarks) Occurs when the delta value of a pointer wheel changes. (다음에서 상속됨 UIElement)
RightTapped (not supported; see Remarks) Occurs when a right-tap input stimulus happens while the pointer is over the element. (다음에서 상속됨 UIElement)
ScriptNotify Occurs when the content contained in the WebView control passes a string to the application by using JavaScript.
SizeChanged Occurs when either the ActualHeight or the ActualWidth property changes value on a FrameworkElement. (다음에서 상속됨 FrameworkElement)
Tapped (not supported; see Remarks) Occurs when an otherwise unhandled Tap interaction occurs over the hit test area of this element. (다음에서 상속됨 UIElement)
Unloaded Occurs when this object is no longer connected to the main object tree. (다음에서 상속됨 FrameworkElement)
UnsafeContentWarningDisplaying Occurs when the WebView shows a warning page for content that was reported as unsafe by SmartScreen Filter.
UnviewableContentIdentified Occurs when the WebView attempts to download an unsupported file.

 

메서드

The WebView 클래스 - 이러한 메서드가 있습니다. 다음 위치의 메서드도 상속합니다. Object 클래스.

메서드Description
AddHandler Adds a routed event handler for a specified routed event, adding the handler to the handler collection on the current element. Specify handledEventsToo as true to have the provided handler be invoked even if the event is handled elsewhere. (다음에서 상속됨 UIElement)
Arrange Positions child objects and determines a size for a UIElement. Parent objects that implement custom layout for their child elements should call this method from their layout override implementations to form a recursive layout update. (다음에서 상속됨 UIElement)
ArrangeOverride Provides the behavior for the Arrange pass of layout. Classes can override this method to define their own Arrange pass behavior. (다음에서 상속됨 FrameworkElement)
BuildLocalStreamUri Creates a URI that you can pass to NavigateToLocalStreamUri.
CancelDirectManipulations Cancels ongoing direct manipulation processing (system-defined panning/zooming) on any ScrollViewer parent that contains the current UIElement. (다음에서 상속됨 UIElement)
CapturePointer Sets pointer capture to a UIElement. Once captured, only the element that has capture will fire pointer-related events. (다음에서 상속됨 UIElement)
CapturePreviewToStreamAsync Creates an image of the current WebView contents and writes it to the specified stream.
CaptureSelectedContentToDataPackageAsync Asynchronously gets a DataPackage that contains the selected content within the WebView.
ClearValue Clears the local value of a dependency property. (다음에서 상속됨 DependencyObject)
FindName Retrieves an object that has the specified identifier name. (다음에서 상속됨 FrameworkElement)
FindSubElementsForTouchTargeting Enables a UIElement subclass to expose child elements that assist with resolving touch targeting. (다음에서 상속됨 UIElement)
Focus Sets the input focus to the WebView.
GetAnimationBaseValue Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (다음에서 상속됨 DependencyObject)
GetBindingExpression Returns the BindingExpression that represents the binding on the specified property. (다음에서 상속됨 FrameworkElement)
GetValue Returns the current effective value of a dependency property from a DependencyObject. (다음에서 상속됨 DependencyObject)
GoBack Navigates the WebView to the previous page in the navigation history.
GoForward Navigates the WebView to the next page in the navigation history.
GoToElementStateCore When implemented in a derived class, enables per-state construction of a visual tree for a control template in code, rather than by loading XAML for all states at control startup. (다음에서 상속됨 FrameworkElement)
InvalidateArrange Invalidates the arrange state (layout) for a UIElement. After the invalidation, the UIElement will have its layout updated, which will occur asynchronously. (다음에서 상속됨 UIElement)
InvalidateMeasure Invalidates the measurement state (layout) for a UIElement. (다음에서 상속됨 UIElement)
InvokeScript Executes the specified script function from the currently loaded HTML, with specific arguments.
InvokeScriptAsync As an asynchronous action, executes the specified script function from the currently loaded HTML, with specific arguments.
Measure Updates the DesiredSize of a UIElement. Typically, objects that implement custom layout for their layout children call this method from their own MeasureOverride implementations to form a recursive layout update. (다음에서 상속됨 UIElement)
MeasureOverride Provides the behavior for the Measure pass of the layout cycle. Classes can override this method to define their own Measure pass behavior. (다음에서 상속됨 FrameworkElement)
Navigate Loads the HTML content at the specified Uniform Resource Identifier (URI).
NavigateToLocalStreamUri Loads local web content at the specified URI using an IUriToStreamResolver.
NavigateToString Loads the specified HTML content as a new document.
NavigateWithHttpRequestMessage Navigates the WebView to a URI with a POST request and HTTP headers.
OnApplyTemplate Invoked whenever application code or internal processes (such as a rebuilding layout pass) call ApplyTemplate. In simplest terms, this means the method is called just before a UI element displays in your app. Override this method to influence the default post-template logic of a class. (다음에서 상속됨 FrameworkElement)
OnCreateAutomationPeer When implemented in a derived class, returns class-specific AutomationPeer implementations for the Microsoft UI Automation infrastructure. (다음에서 상속됨 UIElement)
OnDisconnectVisualChildren Override this method to implement how layout and logic should behave when items are removed from a class-specific content or children property. (다음에서 상속됨 UIElement)
ReadLocalValue Returns the local value of a dependency property, if a local value is set. (다음에서 상속됨 DependencyObject)
Refresh Reloads the current content in the WebView.
ReleasePointerCapture Releases pointer captures for capture of one specific pointer by this UIElement. (다음에서 상속됨 UIElement)
ReleasePointerCaptures Releases all pointer captures held by this element. (다음에서 상속됨 UIElement)
RemoveHandler Removes the specified routed event handler from this UIElement. Typically the handler in question was added by AddHandler. (다음에서 상속됨 UIElement)
SetBinding Attaches a binding to a FrameworkElement, using the provided binding object. (다음에서 상속됨 FrameworkElement)
SetValue Sets the local value of a dependency property on a DependencyObject. (다음에서 상속됨 DependencyObject)
Stop Halts the current WebView navigation or download.
TransformToVisual Returns a transform object that can be used to transform coordinates from the UIElement to the specified object. (다음에서 상속됨 UIElement)
UpdateLayout Ensures that all positions of child objects of a UIElement are properly updated for layout. (다음에서 상속됨 UIElement)

 

속성

WebView클래스 - 이러한 속성이 있습니다.

속성사용 권한Description

ActualHeight

읽기 전용Gets the rendered height of a FrameworkElement. (다음에서 상속됨 FrameworkElement)

ActualWidth

읽기 전용Gets the rendered width of a FrameworkElement. (다음에서 상속됨 FrameworkElement)

AllowDrop

읽기/쓰기Gets or sets a value that determines whether this UIElement can be a drop target for purposes of drag-and-drop operations. (다음에서 상속됨 UIElement)

AllowedScriptNotifyUris

읽기/쓰기Gets or sets a safe list of URIs that are permitted to fire ScriptNotify events to this WebView.

AllowedScriptNotifyUrisProperty

읽기 전용Identifies the AllowedScriptNotifyUris dependency property.

AnyScriptNotifyUri

읽기 전용Gets a value that you can use to set the AllowedScriptNotifyUris property to indicate that any page can fire ScriptNotify events to this WebView.

BaseUri

읽기 전용Gets a Uniform Resource Identifier (URI) that represents the base Uniform Resource Identifier (URI) for an XAML-constructed object at XAML load time. This property is useful for Uniform Resource Identifier (URI) resolution at run time. (다음에서 상속됨 FrameworkElement)

CacheMode

읽기/쓰기Gets or sets a value that indicates that rendered content should be cached as a composited bitmap when possible. (다음에서 상속됨 UIElement)

CanGoBack

읽기 전용Gets a value that indicates whether there is at least one page in the backward navigation history.

CanGoBackProperty

읽기 전용Identifies the CanGoBack dependency property.

CanGoForward

읽기 전용Gets a value that indicates whether there is at least one page in the forward navigation history.

CanGoForwardProperty

읽기 전용Identifies the CanGoForward dependency property.

Clip

읽기/쓰기Gets or sets the RectangleGeometry used to define the outline of the contents of a UIElement. (다음에서 상속됨 UIElement)

CompositeMode

읽기/쓰기Gets or sets a property that declares alternate composition and blending modes for the element in its parent layout and window. This is relevant for elements that are involved in a mixed XAML / Microsoft DirectX UI. (다음에서 상속됨 UIElement)

DataContext

읽기/쓰기Gets or sets the data context for a FrameworkElement when it participates in data binding. (다음에서 상속됨 FrameworkElement)

DataTransferPackage

읽기 전용Gets a clipboard DataPackage as passed to the WebView.

DataTransferPackageProperty

읽기 전용Identifies the DataTransferPackage dependency property.

DefaultBackgroundColor

읽기/쓰기Gets or sets the color to use as the WebView background when the HTML content does not specify a color.

DefaultBackgroundColorProperty

읽기 전용Identifies the DefaultBackgroundColor dependency property.

DesiredSize

읽기 전용Gets the size that this UIElement computed during the measure pass of the layout process. (다음에서 상속됨 UIElement)

Dispatcher

읽기 전용Gets the CoreDispatcher that this object is associated with. (다음에서 상속됨 DependencyObject)

DocumentTitle

읽기 전용Gets the title of the page currently displayed in the WebView.

DocumentTitleProperty

읽기 전용Identifies the DocumentTitle dependency property.

FlowDirection

읽기/쓰기Gets or sets the direction in which text and other UI elements flow within any parent element that controls their layout. This property can be set to either LeftToRight or RightToLeft. Setting FlowDirection to RightToLeft on any element sets the alignment to the right, the reading order to right-to-left and the layout of the control to flow from right to left. (다음에서 상속됨 FrameworkElement)

Height

읽기/쓰기Gets or sets the suggested height of a FrameworkElement. (다음에서 상속됨 FrameworkElement)

HorizontalAlignment

읽기/쓰기Gets or sets the horizontal alignment characteristics that are applied to a FrameworkElement when it is composed in a layout parent, such as a panel or items control. (다음에서 상속됨 FrameworkElement)

IsDoubleTapEnabled

읽기/쓰기Gets or sets a value that determines whether the DoubleTapped event can originate from that element. (다음에서 상속됨 UIElement)

IsHitTestVisible

읽기/쓰기Gets or sets whether the contained area of this UIElement can return true values for hit testing. (다음에서 상속됨 UIElement)

IsHoldingEnabled

읽기/쓰기Gets or sets a value that determines whether the Holding event can originate from that element. (다음에서 상속됨 UIElement)

IsRightTapEnabled

읽기/쓰기Gets or sets a value that determines whether the RightTapped event can originate from that element. (다음에서 상속됨 UIElement)

IsTapEnabled

읽기/쓰기Gets or sets a value that determines whether the Tapped event can originate from that element. (다음에서 상속됨 UIElement)

Language

읽기/쓰기Gets or sets localization/globalization language information that applies to a FrameworkElement, and also to all child elements of the current FrameworkElement in the object representation and in UI. (다음에서 상속됨 FrameworkElement)

ManipulationMode

읽기/쓰기Gets or sets the ManipulationModes value used for UIElement behavior and interaction with gestures. Setting this value enables handling the manipulation events from this element in app code. (다음에서 상속됨 UIElement)

Margin

읽기/쓰기Gets or sets the outer margin of a FrameworkElement. (다음에서 상속됨 FrameworkElement)

MaxHeight

읽기/쓰기Gets or sets the maximum height constraint of a FrameworkElement. (다음에서 상속됨 FrameworkElement)

MaxWidth

읽기/쓰기Gets or sets the maximum width constraint of a FrameworkElement. (다음에서 상속됨 FrameworkElement)

MinHeight

읽기/쓰기Gets or sets the minimum height constraint of a FrameworkElement. (다음에서 상속됨 FrameworkElement)

MinWidth

읽기/쓰기Gets or sets the minimum width constraint of a FrameworkElement. (다음에서 상속됨 FrameworkElement)

Name

읽기/쓰기Gets or sets the identifying name of the object. When a XAML processor creates the object tree from XAML markup, run-time code can refer to the XAML-declared object by this name. (다음에서 상속됨 FrameworkElement)

Opacity

읽기/쓰기Gets or sets the degree of the object's opacity. (다음에서 상속됨 UIElement)

Parent

읽기 전용Gets the parent object of this FrameworkElement in the object tree. (다음에서 상속됨 FrameworkElement)

PointerCaptures

읽기 전용Gets the set of all captured pointers, represented as Pointer values. (다음에서 상속됨 UIElement)

Projection

읽기/쓰기Gets or sets the perspective projection (3-D effect) to apply when rendering this element. (다음에서 상속됨 UIElement)

RenderSize

읽기 전용Gets the final render size of a UIElement. (다음에서 상속됨 UIElement)

RenderTransform

읽기/쓰기Gets or sets transform information that affects the rendering position of a UIElement. (다음에서 상속됨 UIElement)

RenderTransformOrigin

읽기/쓰기Gets or sets the origin point of any possible render transform declared by RenderTransform, relative to the bounds of the UIElement. (다음에서 상속됨 UIElement)

RequestedTheme

읽기/쓰기Gets or sets the UI theme that is used by the UIElement (and its child elements) for resource determination. The UI theme you specify with RequestedTheme can override the app-level RequestedTheme. (다음에서 상속됨 FrameworkElement)

Resources

읽기/쓰기Gets the locally defined resource dictionary. In XAML, you can establish resource items as child object elements of a frameworkElement.Resources property element, through XAML implicit collection syntax. (다음에서 상속됨 FrameworkElement)

Source

읽기/쓰기Gets or sets the Uniform Resource Identifier (URI) source of the HTML content to display in the WebView control.

SourceProperty

읽기 전용Identifies the Source dependency property.

Style

읽기/쓰기Gets or sets an instance Style that is applied for this object during layout and rendering. (다음에서 상속됨 FrameworkElement)

Tag

읽기/쓰기Gets or sets an arbitrary object value that can be used to store custom information about this object. (다음에서 상속됨 FrameworkElement)

Transitions

읽기/쓰기Gets or sets the collection of Transition style elements that apply to a UIElement. (다음에서 상속됨 UIElement)

Triggers

읽기 전용Gets the collection of triggers for animations that are defined for a FrameworkElement. Not commonly used. (다음에서 상속됨 FrameworkElement)

UseLayoutRounding

읽기/쓰기Gets or sets a value that determines whether rendering for the object and its visual subtree should use rounding behavior that aligns rendering to whole pixels. (다음에서 상속됨 UIElement)

VerticalAlignment

읽기/쓰기Gets or sets the vertical alignment characteristics that are applied to a FrameworkElement when it is composed in a parent object such as a panel or items control. (다음에서 상속됨 FrameworkElement)

Visibility

읽기/쓰기Gets or sets the visibility of a UIElement. A UIElement that is not visible is not rendered and does not communicate its desired size to layout. (다음에서 상속됨 UIElement)

Width

읽기/쓰기Gets or sets the width of a FrameworkElement. (다음에서 상속됨 FrameworkElement)

 

설명

앱에서 웹 콘텐츠를 호스팅하려면 WebView 컨트롤을 사용합니다. Windows 8.1부터 컨트롤 동작이 변경되었습니다. 자세한 내용은 다음을 참조하십시오.

WebViewControl 서브클래스가 아니므로 컨트롤 템플릿이 없습니다. 표시 영역은 WidthHeight 속성으로 제한됩니다.

WebViewControl 하위 클래스가 아니지만 키보드 입력 포커스를 받고 탭 시퀀스에 관여할 수 있습니다. Focus 메서드와 GotFocusLostFocus 이벤트를 제공하지만 탭 관련 속성은 없습니다. 탭 순서의 위치는 XAML 문서 순서의 위치와 같습니다. 탭 시퀀스는 입력 포커스를 받을 수 있는 WebView 콘텐츠의 모든 요소를 포함합니다.

이벤트 표에 표시된 대로 WebViewKeyDown, KeyUp, PointerPressed와 같은 UIElement에서 상속된 대부분의 사용자 입력 이벤트를 지원하지 않습니다. 이 문제를 해결하는 일반적인 방법은 WebView.InvokeScript(Windows 8에서 시작하는InvokeScriptAsync)를 eval과 함께 사용하여 HTML 이벤트 처리기를 사용하고 HTML 이벤트 처리기의 window.external.notify를 사용하여 WebView.ScriptNotify를 사용하는 응용 프로그램에 알리는 것입니다.

또한 WebView는 현재 AppCache, IndexedDB, 클립보드에 대한 프로그래밍 방식 액세스, 지리적 위치를 포함한 일부 HTML5 기능을 지원하지 않습니다.

Windows 8

이러한 설명은 Windows 8용으로 컴파일된 앱에만 적용됩니다. Windows 8.1에서 실행되는 경우에도 마찬가지입니다.

WebView에는 컨트롤 같은 다른 UI 영역을 WebView 위에서 렌더링할 수 없다는 특성이 있습니다. 이 "에어스페이스 문제"는 창 영역을 내부적으로 처리하는 방법, 특히 입력 이벤트를 처리하고 화면을 그리는 방법 때문에 발생합니다. HTML 콘텐츠를 렌더링하고 다른 UI 요소도 해당 HTML 콘텐츠 위에 두려면 WebViewBrush를 렌더링 영역으로 사용해야 합니다. WebView에서 여전히 HTML 소스 정보를 제공하므로, SourceName 속성을 통해 해당 WebView를 참조할 수 있습니다. WebViewBrush에는 이 오버레이 제한이 없습니다.

가끔씩만 겹치는 콘텐츠가 있는 대화형 WebView(드롭다운 목록 또는 앱 바)를 표시하려면 필요한 경우 WebViewBrush 채우기를 사용하여 WebView 컨트롤을 요소로 바꿔 일시적으로 숨길 수 있습니다. 그런 다음 겹치는 콘텐츠가 더 이상 존재하지 않으면 원래 WebView를 다시 표시할 수 있습니다.

참고  "에어스페이스 문제"는 Windows 8.1부터 해결되었습니다.

WebView는 항상 문서 모드에서 Internet Explorer 10을 사용합니다.

WebViewms-appdata 체계를 지원하지 않습니다. 하지만 앱 패키지에서 콘텐츠 파일을 로드하는 데 사용할 수 있는 ms-appx-web 체계를 지원합니다.



<WebView Source="ms-appx-web:///HTMLPage1.html"/>


Windows 8.1

Windows 8.1에서는 몇 가지 문제가 해결되고 다음을 비롯한 새로운 기능이 추가되도록 WebView 컨트롤이 변경되었습니다.

  • WebView 컨트롤 위에 XAML 콘텐츠(예: AppBar)를 표시하도록 지원합니다. XAML 콘텐츠를 오버레이하려는 경우 WebViewBrush를 사용하여 WebView 콘텐츠를 렌더링해야 했던 Windows 8의 "에어스페이스 문제"를 해결합니다.
  • RenderTransform을 사용하여 WebView 컨트롤에 대해 변환, 배율 조정, 기울이기 및 회전 작업을 수행할 수 있도록 지원합니다.
  • WebView 컨트롤과 함께 Opacity 속성을 사용할 수 있도록 지원합니다.
  • 기본 탐색을 위한 새로운 API: GoBack, GoForward, Stop, Refresh, CanGoBackCanGoForward. 앱에 일반적인 웹 검색 기능을 추가할 수 있습니다.
  • POST 요청과 HTTP 헤더를 사용하여 URL로 이동하기 위한 NavigateWithHttpRequestMessage 메서드입니다.
  • 사용자 지정 해결 프로그램을 통해 로컬 콘텐츠를 로드할 NavigateToLocalStreamUri 메서드입니다. 이를 사용하면 오프라인에서 사용할 수 있도록 웹 기반 콘텐츠를 다운로드하고 캐싱하는 것과 같은 고급 시나리오를 사용할 수 있습니다.
  • 탐색 및 콘텐츠 로드 상태에 대응하기 위한 새로운 이벤트: NavigationStarting, ContentLoading, DOMContentLoaded, NavigationCompleted, FrameNavigationStarting, FrameContentLoading, FrameDOMContentLoadedFrameNavigationCompleted.
  • 잠재적인 문제 상황에 대응하기 위한 새로운 이벤트: LongRunningScriptDetected, UnsafeContentWarningDisplayingUnviewableContentIdentified.
  • WebView에 입력 포커스를 설정할 Focus 메서드입니다.
  • 호스트된 콘텐츠의 미리 보기 이미지를 가져올 CapturePreviewToStreamAsync 메서드입니다.
  • InvokeScriptAsyncCaptureSelectedContentToDataPackageAsync는 스크립트를 호출하고 공유할 데이터 패키지로 선택된 콘텐츠를 가져오는 비동기 메서드입니다.
  • 문서 제목을 가져오고 기본 배경색을 설정하기 위한 새로운 속성: DocumentTitleDefaultBackgroundColor.
  • LocalFolderTemporaryFolder 데이터 저장소를 사용하여 ms-appdata 체계를 지원합니다. 이를 사용하면 ms-appdata:///local/folder/file.html 및 ms-appdata:///temp/folder/file.html과 같은 URI를 탐색할 수 있습니다. WebView에서 이 스키마를 지원하려면 로컬 또는 임시 폴더의 하위 폴더에 콘텐츠를 배치해야 합니다. 이러한 첫 번째 수준의 하위 폴더는 각각 다른 첫 번째 수준 하위 폴더의 콘텐츠에서 격리됩니다. 예를 들어 ms-appdata:///temp/folder1/file.html 파일을 탐색할 수 있지만 이 파일에 ms-appdata:///temp/folder2/file.html에 대한 링크를 추가할 수는 없습니다.
WebView - 항상 문서 모드에서 Internet Explorer 11을 사용합니다.

Windows 8.1에서는 다음 WebView API가 사용되지 않습니다.

이러한 변경 내용은 Windows 8에 대해 컴파일된 앱에 영향을 미치지 않습니다. Windows 8.1에서 실행되는 경우에도 마찬가지입니다.

예제

다음 코드 예제에서는 Address라는 TextBox에 포함된 URI로 WebView를 탐색하는 방법을 보여 줍니다. 이 예제와 다음 예제에 대한 전체 코드 목록은 WebView 컨트롤 샘플에서 사용할 수 있습니다.


try
{
    Uri targetUri = new Uri(Address.Text);
    WebView1.Navigate(targetUri);
}
catch (FormatException ex)
{
    // Bad address.
}


다음 코드 예제에서는 로컬 HTML을 WebView 컨트롤에 로드하는 방법을 보여 줍니다.


WebView2.NavigateToString(
    "<html><body><h2>This is an HTML fragment</h2></body></html>");

다음 코드 예제는 WebView 컨트롤을 사용하여 로드된 HTML에 포함된 JavaScript 함수를 호출하는 방법을 보여 줍니다.

참고  Windows 8.1부터는 InvokeScript 대신 InvokeScriptAsync를 사용해야 합니다.


string htmlFragment = 
    "<html><head><script type='text/javascript'>function SayGoodbye() { " +
    "document.getElementById('myDiv').innerText = 'GoodBye'; } " +
    "</script></head><body><div id='myDiv'>Hello</div></body></html>";

WebView3.NavigateToString(htmlFragment);

WebView3.InvokeScript("SayGoodbye", null);


요구 사항

지원되는 최소 클라이언트

Windows 8 [Windows 스토어 앱만]

지원되는 최소 서버

Windows Server 2012 [Windows 스토어 앱만]

Namespace

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

Metadata

Windows.winmd

참고 항목

FrameworkElement
XAML WebView 컨트롤 샘플

 

 

표시:
© 2014 Microsoft. All rights reserved.