ExportEffectAttribute(Type, String) 构造函数

定义

创建一个新的 ExportEffectAttribute

public:
 ExportEffectAttribute(Type ^ effectType, System::String ^ uniqueName);
public ExportEffectAttribute (Type effectType, string uniqueName);
new Microsoft.Maui.Controls.ExportEffectAttribute : Type * string -> Microsoft.Maui.Controls.ExportEffectAttribute
Public Sub New (effectType As Type, uniqueName As String)

参数

effectType
Type

标记的 Effect 的类型。

uniqueName
String

Effect 的唯一名称。

注解

开发人员必须提供在提供给ResolutionGroupNameAttribute的值范围内唯一uniqueName的项。 该方法Resolve(String)采用一个字符串,该字符串是提供给ResolutionGroupNameAttribute“'”和提供给ExportEffectAttribute“”.的解析组名称的串联,并返回将具有该类型的effectType效果。

例如,声明如下:

[assembly: ResolutionGroupName ("com.YourCompany")]
[assembly: ExportEffect (typeof (ShadowEffect), "ShadowEffect")]

然后,下面的代码会将效果添加到按钮:

var button = new Button { Text = "I have a shadow" };
button.Effects.Add (Effect.Resolve ("com.YourCompany.ShadowEffect"));

适用于

另请参阅