Home Forums WPF controls Xceed DataGrid for WPF Interface for Items in ObservableCollection

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #23265 |

    I am wondering if there is an interface
    that I can implement in my data item(ObservableCollection<dataitem>) for the observable collection that will tell the datagridcontrol what columns I want.

    All I find is the collection must implement IEnumerable.

    What about the Items in the collection.

    Basically:

    What is the best way to give column information to the datagridcontrol from an observeablecollection?

    Imported from legacy forums. Posted by MiddleTommy (had 4955 views)

    Xceed Support
    Member
    Post count: 5658

    Please refer to this post <a href=”http://forums.xceed.com/forums/ShowPost.aspx?PostID=7610″>http://forums.xceed.com/forums/ShowPost.aspx?PostID=7610</a&gt;

    Imported from legacy forums. Posted by Jenny [Xceed] (had 233 views)

    User (Old forums)
    Member
    Post count: 23064

    There isnt much difference in doing that as adding all the columns manually.

    Imported from legacy forums. Posted by MiddleTommy (had 425 views)

    Xceed Support
    Member
    Post count: 5658

    You can either let all the columns be created and then hide them, of you can use the DataGridCollectionView to only add the columns that you want to appear in the grid (recommended).

    There is not an interface available that will let you flag which columns are to be added and which to exclude.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 329 views)

    User (Old forums)
    Member
    Post count: 23064

    I was thinking it might be IListSource or something similar.

    The problem is when you have an observablecollection of System.Data.DataRow
    the GridControl creates columns for the properties in DataRow and not for the fields.

    I will add the columns manually

    Imported from legacy forums. Posted by MiddleTommy (had 359 views)

    User (Old forums)
    Member
    Post count: 23064

    It would be nice to have something like this included with the grid;

    public interface IColumns
    {
    BasicColumnList getColumns();
    }

    Then all of us can make our DataObjects with it and columns would be a piece of cake

    Imported from legacy forums. Posted by MiddleTommy (had 369 views)

    Xceed Support
    Member
    Post count: 5658

    You can also take a look at the ITypedList interface…

    Imported from legacy forums. Posted by Marcus [Xceed] (had 342 views)

    User (Old forums)
    Member
    Post count: 23064

    An Even better idea is a Custom Attribute that you could assign to properties/fields
    and Xceed WPF Grid would pick up the columns from those attributes.

    I came across this in Linq and thought it applies beautifully to Xceed.

    Imported from legacy forums. Posted by MiddleTommy (had 6166 views)

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.