XmlDataProvider 类

定义

允许以声明方式访问数据绑定的 XML 数据。Enables declarative access to XML data for data binding.

public ref class XmlDataProvider : System::Windows::Data::DataSourceProvider, System::Windows::Markup::IUriContext
[System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)]
[System.Windows.Markup.ContentProperty("XmlSerializer")]
public class XmlDataProvider : System.Windows.Data.DataSourceProvider, System.Windows.Markup.IUriContext
type XmlDataProvider = class
    inherit DataSourceProvider
    interface IUriContext
Public Class XmlDataProvider
Inherits DataSourceProvider
Implements IUriContext
继承
XmlDataProvider
属性
实现

注解

重要

在部分信任沙箱中,当它没有访问给定数据的权限时,XmlDataProvider 失败。In a partial-trust sandbox, XmlDataProvider fails when it does not have permissions to access the given data. 有关部分信任安全的详细信息,请参阅WPF 部分信任安全性For more information about partial trust security, see WPF Partial Trust Security.

XmlDataProvider 公开以下访问 XMLXML 数据的方式。XmlDataProvider exposes the following ways to access XMLXML data.

XmlDataProvider 执行 XmlDocument.NodeChanged 事件时的所有绑定。XmlDataProvider performs a full refresh of all bindings when a XmlDocument.NodeChanged event occurs. 没有针对特定节点的优化。There are no optimizations for specific nodes.

默认情况下,XmlDataProvider.IsAsynchronous 属性设置为 true,这意味着 XmlDataProvider 默认情况下将检索数据并异步生成 XMLXML 节点的集合。The XmlDataProvider.IsAsynchronous property is set to true by default, which means that the XmlDataProvider retrieves data and produces the collection of XMLXML nodes asynchronously by default.

构造函数

XmlDataProvider()

初始化 XmlDataProvider 类的新实例。Initializes a new instance of the XmlDataProvider class.

属性

BaseUri

此类型或成员支持 WPFWPF 基础结构,但不可直接在代码中使用。This type or member supports the WPFWPF infrastructure and is not intended to be used directly from your code.

Data

获取基础数据对象。Gets the underlying data object.

(继承自 DataSourceProvider)
Dispatcher

获取或设置要使用的 Dispatcher 线程当前的 UIUI 对象。Gets or sets the current Dispatcher object to the UIUI thread to use.

(继承自 DataSourceProvider)
Document

获取或设置要用作绑定源的 XmlDocumentGets or sets the XmlDocument to use as the binding source.

Error

获取最新查询操作的错误。Gets the error of the last query operation.

(继承自 DataSourceProvider)
IsAsynchronous

获取或设置一个值,该值指示是在辅助线程还是在活动上下文中执行节点集合创建。Gets or sets a value that indicates whether node collection creation will be performed in a worker thread or in the active context.

IsInitialLoadEnabled

获取或设置一个值,该值指示是否阻止或延迟数据自动加载。Gets or sets a value that indicates whether to prevent or delay the automatic loading of data.

(继承自 DataSourceProvider)
IsRefreshDeferred

获取一个值,该值指示是否有某个未完成的 DeferRefresh() 正在运行。Gets a value that indicates whether there is an outstanding DeferRefresh() in use.

(继承自 DataSourceProvider)
Source

获取或设置要用作绑定源的 Uri 数据文件的 XMLXMLGets or sets the Uri of the XMLXML data file to use as the binding source.

XmlNamespaceManager

获取或设置用于运行 XmlNamespaceManager 查询的 XPathGets or sets the XmlNamespaceManager used to run XPath queries.

XmlSerializer

获取内联 XMLXML 内容。Gets the inline XMLXML content.

XPath

获取或设置用于生成数据集合的 XPath 查询。Gets or sets the XPath query used to generate the data collection.

方法

BeginInit()

指示即将开始初始化此对象;在调用匹配的 Refresh() 方法前不要进行隐式 EndInit()Indicates that initialization of this object is about to begin; no implicit Refresh() occurs until the matched EndInit() method is called.

(继承自 DataSourceProvider)
BeginQuery()

准备加载内联 XMLXML 或外部 XMLXML 文件,以生成 XMLXML 节点的集合。Prepares the loading of either the inline XMLXML or the external XMLXML file to produce a collection of XMLXML nodes.

DeferRefresh()

进入延迟循环,该循环可用于更改提供程序的属性并延迟自动刷新。Enters a defer cycle that you can use to change properties of the provider and delay automatic refresh.

(继承自 DataSourceProvider)
EndInit()

表示此元素的初始化已完成。如果没有其他未完成的 Refresh(),则这会导致 DeferRefresh()Indicates that the initialization of this element has completed; this causes a Refresh() if no other DeferRefresh() is outstanding.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
InitialLoad()

启动对基础数据模型的初始查询。Starts the initial query to the underlying data model. 结果返回到 Data 属性。The result is returned on the Data property.

(继承自 DataSourceProvider)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
OnPropertyChanged(PropertyChangedEventArgs)

通过提供的参数引发 PropertyChanged 事件。Raises the PropertyChanged event with the provided arguments.

(继承自 DataSourceProvider)
OnQueryFinished(Object)

派生类调用此方法以指示查询已完成。Derived classes call this method to indicate that a query has finished.

(继承自 DataSourceProvider)
OnQueryFinished(Object, Exception, DispatcherOperationCallback, Object)

派生类调用此方法以指示查询已完成。Derived classes call this method to indicate that a query has finished.

(继承自 DataSourceProvider)
Refresh()

启动对基础数据模型的刷新操作。Initiates a refresh operation to the underlying data model. 结果返回到 Data 属性。The result is returned on the Data property.

(继承自 DataSourceProvider)
ShouldSerializeSource()

指示是否应使 Source 属性持久化。Indicates whether the Source property should be persisted.

ShouldSerializeXmlSerializer()

指示是否应使 XmlSerializer 属性持久化。Indicates whether the XmlSerializer property should be persisted.

ShouldSerializeXPath()

指示是否应使 XPath 属性持久化。Indicates whether the XPath property should be persisted.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

事件

DataChanged

Data 属性具有一个新值时发生。Occurs when the Data property has a new value.

(继承自 DataSourceProvider)
PropertyChanged

在属性值更改时发生。Occurs when a property value changes.

(继承自 DataSourceProvider)

显式接口实现

INotifyPropertyChanged.PropertyChanged

在属性值更改时发生。Occurs when a property value changes.

(继承自 DataSourceProvider)
ISupportInitialize.BeginInit()

此成员支持 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基础结构,但不能在代码中直接使用。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

(继承自 DataSourceProvider)
ISupportInitialize.EndInit()

此成员支持 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基础结构,但不能在代码中直接使用。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

(继承自 DataSourceProvider)
IUriContext.BaseUri

此成员支持 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基础结构,但不能在代码中直接使用。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

适用于

另请参阅