1

我正在尝试按照此处的说明在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; }
   }
4

2 回答 2

3

您应该添加程序集Xceed.Wpf.Toolkit.dll,然后您应该添加以下命名空间:

using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
于 2013-05-16T18:51:35.943 回答
0

您是否在语句中包含Xceed.Wpf.Toolkit.PropertyGrid.Attributes命名空间?using

于 2013-05-16T18:51:12.050 回答