Wenhao.SHE
Wenhao.SHE

Reputation: 2021

How to selectively display and not display column of object in BindingList which is bond to gridcontrol of devexpress winform?

Dear all devexpress winform gurus:)

My way is simple. First, i create a bindinglist:

 private BindingList<QuoteOnGrid> quoteOnGrids = new BindingList<QuoteOnGrid>();

Then my object called quote will be added to the BindingList above, the quote have multiple properties and will be displayed on the grid after binding code below:

 gridControl1.DataSource = quoteOnGrids;

The picture below show how manually remove column

a busy cat http://i.minus.com/i1JuwLqAdWy2K.jpg

How could I disable the displaying of last three property of these financial quote object without removing these properties?:)

Thanks in advance!

Upvotes: 0

Views: 1487

Answers (1)

DmitryG
DmitryG

Reputation: 17848

Please use the GridColumn.Visible property:

//...
    gridControl1.DataSource = new BindingList<Person>();
    gridView1.Columns["ID"].Visible = false;
}
//...
class Person {
    public int ID { get; set; }
    public string Name { get; set; }
    public int Age { get; set; }
}

Upvotes: 3

Related Questions