简体   繁体   中英

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!

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; }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM