PlatformBehavior<TView,TPlatformView> 类

定义

通用用户定义行为的基类,可在连接到平台视图层次结构时响应任意条件和事件。

generic <typename TView, typename TPlatformView>
 where TView : Element where TPlatformView : classpublic ref class PlatformBehavior abstract : Microsoft::Maui::Controls::Behavior<TView>
public abstract class PlatformBehavior<TView,TPlatformView> : Microsoft.Maui.Controls.Behavior<TView> where TView : Element where TPlatformView : class
type PlatformBehavior<'View, 'PlatformView (requires 'View :> Element and 'PlatformView : null)> = class
    inherit Behavior<'View (requires 'View :> Element)>
Public MustInherit Class PlatformBehavior(Of TView, TPlatformView)
Inherits Behavior(Of TView)

类型参数

TView

虚拟视图

TPlatformView

平台视图

继承
Behavior<TView>
PlatformBehavior<TView,TPlatformView>
派生

构造函数

PlatformBehavior<TView,TPlatformView>()

通用用户定义行为的基类,可在连接到平台视图层次结构时响应任意条件和事件。

属性

AssociatedType

获取 Behavior 可与之关联的对象类型。

(继承自 Behavior)
BindingContext

获取或设置一个 对象,该对象包含属于此 BindableObject的绑定属性的目标属性。 这是一种可绑定属性。

(继承自 BindableObject)
Dispatcher

获取创建此可绑定对象时可用的调度程序,否则尝试查找最近的可用调度程序 (可能为窗口/应用的) 。

(继承自 BindableObject)

方法

ApplyBindings()

将所有当前绑定应用于 BindingContext

(继承自 BindableObject)
ClearValue(BindableProperty)

清除以前为可绑定属性设置的任何值。

(继承自 BindableObject)
ClearValue(BindablePropertyKey)

清除以前为可绑定属性设置的任何值(由其键标识)。

(继承自 BindableObject)
CoerceValue(BindableProperty)

强制指定可绑定属性的值。 这是通过调用 BindableProperty.CoerceValueDelegate 指定的可绑定属性来完成的。

(继承自 BindableObject)
CoerceValue(BindablePropertyKey)

强制指定可绑定属性的值。 这是通过调用 BindableProperty.CoerceValueDelegate 指定的可绑定属性来完成的。

(继承自 BindableObject)
GetValue(BindableProperty)

返回给定可绑定属性中包含的值。

(继承自 BindableObject)
IsSet(BindableProperty)

确定可绑定属性是否存在并且是否设置了值。

(继承自 BindableObject)
OnAttachedTo(BindableObject)

应用程序开发者可重写此方法以实现与 bindable 关联的行为。

OnAttachedTo(TView)

应用程序开发者可重写此方法以实现与 bindable 关联的行为。

OnAttachedTo(TView, TPlatformView)

当可绑定内容附加到平台视图层次结构时,将调用此方法。

OnBindingContextChanged()

引发 BindingContextChanged 事件。

(继承自 BindableObject)
OnDetachedFrom(TView, TPlatformView)

当可绑定内容与平台视图层次结构分离时,将调用此方法。

OnDetachingFrom(BindableObject)

应用程序开发者可重写此方法,从先前调用 OnAttachedTo(BindableObject) 方法实现的 bindable 中删除行为。

OnDetachingFrom(TView)

应用程序开发者可重写此方法,从先前调用 OnAttachedTo(T) 方法实现的 bindable 中删除行为。

OnPropertyChanged(String)

引发 PropertyChanged 事件。

(继承自 BindableObject)
OnPropertyChanging(String)

引发 PropertyChanging 事件。

(继承自 BindableObject)
RemoveBinding(BindableProperty)

从可绑定属性中删除以前设置的绑定。

(继承自 BindableObject)
SetBinding(BindableProperty, BindingBase)

将绑定分配给可绑定属性。

(继承自 BindableObject)
SetValue(BindableProperty, Object)

设置指定的可绑定属性的值。

(继承自 BindableObject)
SetValue(BindablePropertyKey, Object)

设置指定的可绑定属性的值。

(继承自 BindableObject)
SetValueCore(BindableProperty, Object, SetValueFlags)

供 Microsoft.Maui.Controls 平台内部使用。

(继承自 BindableObject)
UnapplyBindings()

从当前上下文中删除所有当前绑定。

(继承自 BindableObject)

事件

BindingContextChanged

BindingContext 属性的值更改时发生。

(继承自 BindableObject)
PropertyChanged

在属性值更改时发生。

(继承自 BindableObject)
PropertyChanging

在属性值更改时发生。

(继承自 BindableObject)

显式接口实现

IDynamicResourceHandler.SetDynamicResource(BindableProperty, String)

通用用户定义行为的基类,可在连接到平台视图层次结构时响应任意条件和事件。

(继承自 BindableObject)

扩展方法

GetPropertyIfSet<T>(BindableObject, BindableProperty, T)

通用用户定义行为的基类,可在连接到平台视图层次结构时响应任意条件和事件。

SetAppTheme<T>(BindableObject, BindableProperty, T, T)

通用用户定义行为的基类,可在连接到平台视图层次结构时响应任意条件和事件。

SetAppThemeColor(BindableObject, BindableProperty, Color, Color)

通用用户定义行为的基类,可在连接到平台视图层次结构时响应任意条件和事件。

SetBinding(BindableObject, BindableProperty, String, BindingMode, IValueConverter, String)

创建绑定并将其应用到属性。

适用于