Menu.DataBind 方法

定义

将数据源绑定到 Menu 控件。Binds the data source to the Menu control. 无法继承此方法。This method cannot be inherited.

public:
 override void DataBind();
public override sealed void DataBind ();
override this.DataBind : unit -> unit
Public Overrides NotOverridable Sub DataBind ()

注解

当从类派生自定义控件时,此成员主要由控件开发人员使用 MenuThis member is used primarily by control developers when deriving a custom control from the Menu class.

使用 DataBind 方法可将数据从数据源绑定到 Menu 控件。Use the DataBind method to bind data from a data source to the Menu control. 此方法解析控件的活动模板中的所有数据绑定表达式。This method resolves all data-binding expressions in the active template of the control.

继承者说明

数据绑定控件应重写 PerformDataBinding() 而不是 DataBind()Data-bound controls should override PerformDataBinding() instead of DataBind(). 如果 DataBind() 重写,则 OnDataBinding(EventArgs)OnDataBound(EventArgs) 错误的顺序引发和事件。If DataBind() is overridden, the OnDataBinding(EventArgs) and OnDataBound(EventArgs) events are raised in the wrong order.

适用于