我正在尝试创建自定义控件的多值复杂属性,但为其编写的代码不起作用,只有多值只读属性进入属性资源管理器。这是它的代码
private MyComboProperties _MyComboProperties;
public MyComboProperties MyComboPropertiesValues
{
get
{
return _MyComboProperties;
}
set
{
_MyComboProperties = value;
}
}
//MyComboProperties struct is like this
[System.Runtime.InteropServices.ComVisible(true)]
public struct MyComboProperties
{
private string _MySourceQuery;
private string _MyDisplayMember;
private string _MyValueMember;
public MyComboProperties(string mySourceQuery, string myDisplayMember, string myValueMember)
{
_MySourceQuery = mySourceQuery;
_MyDisplayMember = myDisplayMember;
_MyValueMember = myValueMember;
}
public string MySourceQuery
{
get
{
return _MySourceQuery;
}
set
{
_MySourceQuery = value;
}
}
public string MyDisplayMember
{
get
{
return _MyDisplayMember;
}
set
{
_MyDisplayMember = value;
}
}
public string MyValueMember
{
get
{
return _MyValueMember;
}
set
{
_MyValueMember = value;
}
}
}
或者有人为我提供了具有 3 个输入字符串值的多值自定义控件的示例代码。