Welcome to the Xceed Community | Help
Community Search  
More Search Options

A List(of T) bound to DataGrid, but no data

Sort Posts: Previous Next
  •  10-31-2008, 6:04 PM Post no. 16548

    A List(of T) bound to DataGrid, but no data

    I have a Class that inherts from List(of T) bound to my DataGrid. The data grid shows the columns but no data. I add an item to my collection in the window's load event. This is where I populate by data table, wchich works. So what am I missing?
    Filed under: ,
  •  10-31-2008, 9:26 PM Post no. 16550 in reply to 16548

    Re: A List(of T) bound to DataGrid, but no data

    Ok, I bound the List(of T) in my VB code instead of XAML and I got data. But I didn't get any collection properties, which are also List(of T). The documentation says that these will be automatically created. So why not? I added the column explicitly,but it only displayed "(Collection)". I added a DetailConfiguration with RelationName as the name of the collection property (I couldn't find in the documentation what you are supposed to put here when its a subcollection and not a database). It still displays "(Collection)" So what do I need to do? 
  •  11-03-2008, 9:43 AM Post no. 16572 in reply to 16550

    Re: A List(of T) bound to DataGrid, but no data

    Have you set the grid's AutoCreateDetailConfigurations property to  true?
    Senior Technical Writer
    - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
  •  11-03-2008, 6:23 PM Post no. 16609 in reply to 16572

    Re: A List(of T) bound to DataGrid, but no data

    Yes, I set AutoCreateDetailConfigurations property to  true.

     I can only get data if I bind thru VB code and not xaml. But, in order to use the CollectionViewSource (where all the good features seem to be), you have to bind thru xaml. I'm frusrated that I can't get past first base. All your samples have the bound object in the application. Mine is in the page. My cvs source statement is Source="{Binding EBookFiles, ElementName=root}"  and I added the attribute x:Name="root" to the page. This has worked with other software and Xceed seems to find it since it lists my columns, but no data. Am I missing something? Is this not a valid way to bind?

     

  •  11-03-2008, 8:23 PM Post no. 16614 in reply to 16609

    Re: A List(of T) bound to DataGrid, but no data

    Ok, I moved my collection to the application and used the sample syntax for binding. Still no data. So in the application I add one row. I see this row, but not the rows my page added even though it does "DataGridControl1.Items.Refresh()" , which worked when I bound thru VB code. So, I made one last try:

     CType(DataGridControl1.ItemsSource, Xceed.Wpf.DataGrid.DataGridCollectionView).Refresh().

     I got data! Halleluiah! This is not exactly an obvious choice. The documentation should explain this or maybe there is a less ugly way of refreshing the source.  All the examples cheet by loading the data before the page is loaded.

     

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.