DevExpress控件使用交流,DevExpress中国社区Dev联系电话 联系电话:023-68661681

如何在DevExpress DetailView中的显示所有细节而不单是组合框

来源:本站原创   发布时间:2012-05-18   浏览:2523次

问题描述:

如何才能显示DevExpress DetailView对象中的所有细节,而不是只显示默认属性值(DefaultProperty)的组合框?

附录里是此问题的详细描述。

下面是部分类:

[DefaultClassOptions]

public class CTe : BaseObject

{

.....

private Emitente emitente;

public Emitente Emitente

{

get { return this.emitente; }

set { SetPropertyValue("Emitente", ref emitente, value); }

}

我需要显示所有Emitente细节,而不是只显示组合框中的默认属性值。我该怎么办呢?

问题解答:

有两种方法可以解决以上问题:

1、使用ExpandObjectMembersAttribute(ExpandObjectMembers.InDetailView) 特征装饰Emitente属性。

2、为此属性分配DevExpress.ExpressApp.Editors.DetailPropertyEditor。你可以通过模型编辑器或者装饰属性EditorAlias(DevExpress.ExpressApp.Editors.EditorAliases.DetailPropertyEditor)的特征来完成此操作。

附录:

这是Emitente类,CTe对象的属性。

如何在DevExpress DetailView中的显示所有细节而不单是组合框

这是CTe对象:

如何在DevExpress DetailView中的显示所有细节而不单是组合框

我们需要显示所有Emitente数据而不单是Nome Fantasia属性。怎样才能实现呢?下面是视图模型详情。

下面是Emitente类:

[DefaultProperty("NomeFantasia")]
   public class Emitente : Entidade
   {
      public Emitente(Session session) : base(session) { }
      public override void AfterConstruction()
      {
         base.AfterConstruction();
         // Place here your initialization code.
      }
   }
}

下面是entidade类:

[DefaultClassOptions]
   public class Entidade : BaseObject
   {
      public Entidade(Session session)
      : base(session)
      {
      }
      public override void AfterConstruction()
      {
         base.AfterConstruction();
         // Place here your initialization code.
      }
      private String cpf;
      public string Cpf
      {
         get { return this.cpf; }
         set { SetPropertyValue("Cpf", ref cpf, value); }
      }
      private String cnpj;
      public string Cnpj
      {
         get { return this.cnpj; }
         set { SetPropertyValue("Cnpj", ref cnpj, value); }
      }
      private String inscricaoEstadual;
      public string InscricaoEstadual
      {
         get { return this.inscricaoEstadual; }
         set { SetPropertyValue("InscricaoEstadual", ref inscricaoEstadual, value); }
      }
      private String razao;
      public string Razao
      {
         get { return this.razao; }
         set { SetPropertyValue("Razao", ref razao, value); }
      }
      private String nomeFantasia;
      public string NomeFantasia
      {
         get { return this.nomeFantasia; }
         set { SetPropertyValue("NomeFantasia", ref nomeFantasia, value); }
      }
      private String logradouro;
      public string Logradouro
      {
         get { return this.logradouro; }
         set { SetPropertyValue("Logradouro", ref logradouro, value); }
      }
      private int numero;
      public int Numero
      {
         get { return this.numero; }
         set { SetPropertyValue("Numero", ref numero, value); }
      }
      private String complemento;
      public string Complemento
      {
         get { return this.complemento; }
         set { SetPropertyValue("Complemento", ref complemento, value); }
      }
      private String bairro;
      public string Bairro
      {
         get { return this.bairro; }
         set { SetPropertyValue("Bairro", ref bairro, value); }
      }
      private String cep;
      public string Cep
      {
         get { return this.cep; }
         set { SetPropertyValue("Cep", ref cep, value); }
      }
      private String pais;
      public string Pais
      {
         get { return this.pais; }
         set { SetPropertyValue("Pais", ref pais, value); }
      }
      private Ufs uf;
      public Ufs Uf
      {
         get { return this.uf; }
         set { SetPropertyValue("Uf", ref uf, value); }
      }
      private String municipio;
      public string Municipio
      {
         get { return this.municipio; }
         set { SetPropertyValue("Municipio", ref municipio, value); }
      }
      private String telefone;
      public string Telefone
      {
         get { return this.telefone; }
         set { SetPropertyValue("Telefone", ref telefone, value); }
      }
}

本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/201.html
在线
客服
微信
QQ 电话
023-68661681
返回
顶部