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 に答える