This is a migrated thread and some comments may be shown as answers.

Binding to a composite property

4 Answers 74 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ivano
Top achievements
Rank 1
Ivano asked on 28 Apr 2010, 09:28 AM

I’m using a generic item wrapper defined as below:

    public class ItemWrapper

    {

        public State State { get; set; }

        public string Message { get; set; }

        public object Item { get; set; }

    }

    public enum State

    {

        Ok,

        Warning,

        Error

    }

 

The ItemWrapper could contain objects from different classes in the Item property; for instance:

 

ItemWrapper wrapper = new ItemWrapper();

wrapper.Item = new Company() {Id = "Acme", Desc="Acme company" };

 

The point is how to bind RadGridView columns to show both ItemWrapper columns (State and Message) and wrapped object columns ( Company.Id and Company.Desc).

Binding ItemWrapper properties is ok while the expected way for Company should be:

col.DataMemberBinding = new Binding("Item.Id");

col.DataType = typeof(string);

 

that seems, at least, to work but raising lot of exceptions:

A first chance exception of type 'System.ArgumentException' occurred in Telerik.Windows.Data.dll

 

that slow down rows loading to several second for few items (making control unusable) .

Sincerely

4 Answers, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 30 Apr 2010, 03:05 PM
Hi Ivano,

Can you try to run your project without attached debugger (Ctrl+F5)? Is the performance still poor?

Regards,
Stefan Dobrev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ivano
Top achievements
Rank 1
answered on 02 May 2010, 06:01 PM
No running project without attached debugger is fast as expected.

Regards
0
Ivano
Top achievements
Rank 1
answered on 13 May 2010, 02:46 PM
Sorry but I've to undo my last post.
Now I've tried with a more realistic example of 8.000 items (that could not be considered a large number); even without attached debugger, the control becomes incredibly slowly, memory usage increase up to 1Gb and finally crashes with an "out of memory" error.

Regards
Ivano
0
Stefan Dobrev
Telerik team
answered on 14 May 2010, 03:57 PM
Hello Ivano,

Can you try to use GridViewColumn, instread of GridViewDataColumn for this "composite property column"? You will have to set the CellTemplate property for this column.

All the best,
Stefan Dobrev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Ivano
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Ivano
Top achievements
Rank 1
Share this question
or