我正在尝试按照此处的说明在Xceed PropertyGrid 中显示此类实例:
PG.SelectedObject = new Order()
{
ShipAddress = "Luisenstr. 48",
ShipCountry = "Germany",
ShipName = "Toms Spezialitaten",
ShipPostalCode = "44087",
chronology = new OrderChronology()
{
OrderDate = new DateTime(1996, 7, 5),
ShippedDate = new DateTime(1996, 8, 16)
}
};
Xceed 行为类似于我正在尝试做的示例说明you must decorate your property with the ExpandableObject attribute.
并显示了这一点:
public class Person
{
[Category("Information")]
[DisplayName("First Name")]
[Description("This property uses a TextBox as the default editor.")]
public string FirstName { get; set; }
[Category("Conections")]
[Description("This property is a complex property and has no default editor.")]
[ExpandableObject]
public Person Spouse { get; set; }
}
当我尝试对我的类做同样的事情时(见下文),它会导致编译器错误;它不喜欢[ExpandableObject]
并暗示我可能是missing a using directive or assembly reference
。我是吗?
public class Order
{
public string ShipAddress { get; set; }
public string ShipCountry { get; set; }
public String ShipName { get; set; }
public String ShipPostalCode { get; set; }
[ExpandableObject]
public OrderChronology chronology;
}
public class OrderChronology
{
public DateTime OrderDate { get; set; }
public DateTime ShippedDate { get; set; }
}