We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Grid DataControl problems and questions

Hello!

I am trying to implement a simple UI with the new GridDataControl. But it is not working! All I can see is a small gray rectangle!
Here is my code:

RowBackground="White"
AlternatingRowBackground="#EFF6F6"
AlternatingRowCount="2"
AutoPopulateColumns="False"
AutoPopulateRelations="False"
ItemsSource="{Binding DatabaseEntitySetModel}"
MinHeight="500"
MinWidth="500"
>


HeaderText="Kontoname" Width="100"
/>



I am not sure how this Mapping is working.
We have a set and a single Item in this Set has the property "Kontoname". Is this way of definig it right? In the WPFToolkit Datagrid it is working...




4 Replies

MS Mohamed Suhaib Fahad A. Syncfusion Team March 3, 2009 02:21 PM UTC

Hi Sina,

Thanks for using Syncfusion products. Only if the ItemsSource is null you would see an empty rectangle. I would like to know the way you bind to the ItemsSource and also the Set you use. Currently all IEnumerable source type is supported in the GridDataControl.

Please check the following sample which binds through the DataContext,

http://www.syncfusion.com/uploads/redirect.aspx?file=CS_cea18ed7.zip&team=development

Regarding the MappingName, it is the exact reference name of the property you define in you business object. Say, a Person class has Name and Desig properties, then the MappingName should exactly match these values.

Let me know if that helps you out.

Thanks,
Fahad
Grid.WPF Team
Syncfusion Inc.,


SA Sina Andrzejewski March 4, 2009 07:16 AM UTC

Hello Fahad!

Thank you for your help. That is the example which I took to make my code posted before. The MappingName exactly fits the Properties in my business object.
The ItemsSource is not null. It is set to our ViewModel. The ViewModel is a set of single items from our database. I tried setting it in Xaml: ItemsSource="{Binding DatabaseEntitySetModel}" and in the code behind:
set
{
KontoModel val = value as KontoModel;
this.DataContext = val;
this._synKontoGrid.ItemsSource = val.DatabaseEntitySetModel;
}
I don't know if there is a Problem because the set does not contain the MappingName fields but only the single Items? The set inherits from System.ComponentModel.IBindingList so it should be IEnumerable. And it is working with the WPFToolkit Datagrid...



MS Mohamed Suhaib Fahad A. Syncfusion Team March 4, 2009 03:15 PM UTC

Hi Sina,

Thanks for the details. If the set is not containing the MappingName fields, then the Grid will not identify the column. You can check out by setting the "AutopopulateColumns=True", and then see how the output is generated in the Grid, that would give you an idea on the MappingName you have to specify.

May be a simple sample would be good enough for me to check out quickly. Please let me know.

Thanks,
Fahad
Grid.WPF Team
Syncfusion Inc.,



MS Mohamed Suhaib Fahad A. Syncfusion Team March 4, 2009 10:13 PM UTC

Hi Sina,

I checked out some default settings with the GridDataControl when you have the AutoPopulateColumns=false. You need to explicitly define the Width property for the columns, the default value property would be applied only when we have that property set as true. This behavior would be changed accordingly in our source. Also, try to the set the ItemsSource for the Grid, after the Loaded event. And if you are directly binding it thru XAML, then use the approach that I had shown in my previous sample.

If you are still not able to view anything, I would want your sample for checking out.

Thanks,
Fahad
Grid.WPF Team
Syncfusion Inc.,


Loader.
Live Chat Icon For mobile
Up arrow icon