Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 添加具有唯一内容的自定义属性_C#_Wpf_Attributes_Dependency Properties_Custom Attributes - Fatal编程技术网

C# 添加具有唯一内容的自定义属性

C# 添加具有唯一内容的自定义属性,c#,wpf,attributes,dependency-properties,custom-attributes,C#,Wpf,Attributes,Dependency Properties,Custom Attributes,我正在寻找向xaml控件添加自定义属性的方法 我找到了这个解决方案: 我的问题不是:如何只允许唯一的内容(如name属性)?附加属性的行为是“允许不同的子元素为父元素中实际定义的属性指定唯一值” 阅读“为什么要使用附加属性””部分以更好地理解。因此,我们无法保持唯一值 Ref::您尝试了什么?更新中的示例question@RameshMuthiah我不知道…你的要求是什么?@RameshMuthiah我想给不同的控件起一个“第二个名字”(比如name属性)。“第二个名字”必须始终不同。

我正在寻找向xaml控件添加自定义属性的方法

我找到了这个解决方案:


我的问题不是:如何只允许唯一的内容(如name属性)?

附加属性的行为是“允许不同的子元素为父元素中实际定义的属性指定唯一值”

阅读“
为什么要使用附加属性”
”部分以更好地理解。因此,我们无法保持唯一值


Ref::

您尝试了什么?更新中的示例question@RameshMuthiah我不知道…你的要求是什么?@RameshMuthiah我想给不同的控件起一个“第二个名字”(比如name属性)。“第二个名字”必须始终不同。