views:

312

answers:

2

Hi Folks,

I'm using XtraGrid of DevExpress 2.9.5 to display a blotter of dynamic set of lines. The blotter is integrated into another application, this is why it has to be based on UserControl class and also implement a couple of custom interfaces.

public partial class BlotterForm : UserControl, ISMMdiEmbeddable, ISMAssociatedMFCWindow 
{
     private BindingList<BlotterTrade> fDeals;
....
}

As the data is binded to control using BindedList, any change should be reflected in the form automatically. And if I try to add new line to fDeals like follows:

public void AddDeal()
{
    fDeals.Add(new BlotterTrade(1,2,3));
}

... i can see the line, but it's content is rubbish.

I tried to do the same in a small test application. It works ok with only difference that the blotter in test application is based on DevExpress.XtraEditors.XtraForm. To me it looks now that the form of original blotter doesn't overload some method or miss some event. But I cannot find out what exactly is missed.

Can somebody tell me what I do wrong or don't do?

Thanks.

A: 

A couple of things:

  1. BindingList doesn't always work too well with DevExpress, and it's suggested to use XPCollection instead.

  2. Do you have any more info about how you setup your columns in the xtragrid? If you use incorrect field names in the column, then they won't show what you're looking for.

  3. If the params you're using (1, 2, 3) are ids stored as fkeys to other objects (not sure if you're using xpo or not) then they won't show up correctly either (there'll likely be a '+' in the cell instead of any values).

  4. [aside] be sure that blottertrade implements INotifyPropertyChanged for better interaction with the grid.

SnOrfus
A: 

Thanks to everybody for the answers and comments. I think I sorted out the problem. It was actually related to interaction between native C++ and C# layers in my application. The object that was supposed to be displayed in XtraGrid was created in C++ layer, the grid was displayed asynchronously with object construction/deconstruction, that's why at the moment when the grid was ready to display it, the object itself didn't exist. Hence the rubbish. It's good the grid itself was not crashing or firing exceptions.

sergey.sokolov