Hi,
I'm binding a grid to a custom datasource. My problem is that columns don't appear exactly as i'd like.
I can't set order and header's caption to columns, as well as, to decide which columns to be shown and which not.
It seems property order declaration inside the object doesn't determine columns order. So how do I change it?
Wingrid Maps column names to property names. Is there a way of changing it?
I think WinGrid only shows public object properties. I do inherit all my business objects and i don't want to show base class public properties in the grid neither some of the object itself. Again, Does any body knows something about it?
Thanks
If you set the grid's DataSource, then yes - you should see the schema in the grid immediately. This is true whether you implement ITypedList or not. One has nothing to do with the other.
You might want to search the forums for know issues when using multiple threads with the grid, though. Getting your data on another thread can be a pretty dangerous and tricky thing to do and you have to be extremely careful.
Hi Mike,
Mike Saltzman"]You would have to implement ITypedList on your list, which means you can't just use a BindingList<T>, you would have to create your own list class- perhaps derived from BindingList<T> and implement ITypedList.
I have related query, I am implementing the ITypeList. Doesn't this mean the schema of the DataSource is available immediately. And I should be able to see the columns as soon I set the datasource. I am fetching the data on separate thread.
Mike Saltzman"] No, the custom class in this case has nothing to do with it, it's the list that determines the order of the columns. You would have to implement ITypedList on your list, which means you can't just use a BindingList<T>, you would have to create your own list class- perhaps derived from BindingList<T> and implement ITypedList. Personally, I think it's a lot simpler to just re-order the columns in the grid using the column.Header.Position property.
No, the custom class in this case has nothing to do with it, it's the list that determines the order of the columns. You would have to implement ITypedList on your list, which means you can't just use a BindingList<T>, you would have to create your own list class- perhaps derived from BindingList<T> and implement ITypedList.
Personally, I think it's a lot simpler to just re-order the columns in the grid using the column.Header.Position property.
Thanks. I found similar implementation in the some sample code. As you mentioned in the earlier reply for this post. Doing it here means I don't have repeat it on all the grids which use my custom class as data source. Also it allows me to remain loosely coupled with the presenter.
Mike Saltzman"]The Order of the columns is determined by the BindingManager. I beleive it gets these from the ITypedList interface's GetProperties method. This will essentially be random unless you implement this interface yourself.
I am using BindingList<T> of my custom class. On the custom class, do I need to implement some interface to control the column order. What are the other options.