ExportEffectAttribute(Type, String) 构造函数

定义

创建一个新的 ExportEffectAttribute

public ExportEffectAttribute(Type effectType, string uniqueName);
new Xamarin.Forms.ExportEffectAttribute : Type * string -> Xamarin.Forms.ExportEffectAttribute

参数

effectType
System.Type

标记的 Effect 的类型。

uniqueName
System.String

Effect 的唯一名称。

注解

开发人员必须提供在 uniqueName 提供给 ResolutionGroupNameAttribute的值范围内唯一的 。 方法 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"));

适用于

另请参阅