以下のようなカスタムマークアップ拡張機能を作成しました
public class CME: MarkupExtension
{
private Type _type;
private string _typeName;
public CME()
{
}
public CME(Type type, string typeName)
{
this._type = type;
this._typeName = typeName;
}
[ConstructorArgument("type")]
public Type Type
{
get
{
return this._type;
}
set
{
this._type = value;
}
}
[ConstructorArgument("typeName")]
public string TypeName
{
get
{
return this._typeName;
}
set
{
this._typeName = value;
}
}
public override object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}
}
{local:CME {x:Type sys:Boolean},Bool}
そして、CME クラスのすべての ConstructorArgumentAttribute を削除しても、XAML で CME クラスのインスタンスを作成するために使用できることがわかりました。
したがって、カスタム マークアップ拡張機能の実装で ConstructorArgumentAttribute が必要な理由、または ConstructorArgumentAttribute の意味を知りたいです。
これについて助けてくれる人はいますか?どうもありがとう。