Hello,
i got a XamComboEditor inside a XamDataGrid with a LookUpList Int / String. (It works fine)
If i sort after this field, its randomly before or after the DisplayMember is subsituted by the text. (The LookUpList ItemSource is set only once at start, so its always there already.) I saw this in GroupByRecord.Description, while override the GroupByComparer, trying to workaround this..
Shouldnt it always be sorted after subsituted by text. And if not, is there an event i can listen for after loaded a new ItemSource to the Grid? (Binding)
xaml:
c#:_grid.FieldLayouts[0].SortedFields.Clear();_grid.FieldLayouts[0].SortedFields.Add(new FieldSortDescription("NrID", System.ComponentModel.ListSortDirection.Ascending, true));_grid.Records.RefreshSort();
GreetingsKiTs
Hi Joerg,
Correct. The values displayed inside the group are placed there by the XamDataGrid. From the tests I've done, it seems that if the editor is set to a XamComboEditor the grid knows to use the DisplayMemberPath of the selection rather than just the value. Normally the group would display the actual value of the cell which in this case would be an integer. But because it sees that the editor is a XamComboEditor, it's using the display value instead.
The behavior you see would suggest something asynchronous is going on which is causing the integer value to display sometimes. That would be weird though because the grouping occurs on the UI thread. We don't perform grouping on a background thread. I need a sample that reproduces this so I can debug it. Would it be possible for you to send me a runnable version of your application that produces this behavior? If you require a more private method for sending it I can provide an avenue for this.
Hi Rob,
i wasnt exact there. It says "(# Elemente)" which is the german word for items. I dont modify the Description directly.
I'm talking about the value part of the Description ["value (# items)"], which is sometimes the ID and sometimes the Text of the lookup table. This is done by control automatically, right? (DisplayMember) When does it do that exactly? That is where i suggest asynchronous problems. (Sort before the lookup ID is replaced by text.)
I want it to be sorted by DisplayMember. (That works sometimes, sometimes not.)
GreetzJoerg
Hi Jeorg,
Are you directly modifying the text in the GroupByRecord description? I think the default text should be "value (# items)" where it says items rather than records as you have described it. If it says "records" for you, to me that means that you changed the text. Is it possible that that code is messing things up? What if you remove it and go back to the default text?
Hello Rob,
i modified your sample and implemented a custom GroupByComparer. If you debug breakpoint the Compare method, in my project you see the Description Property of the GroupByRecord is sometimes "8 (2 records)" and sometimes substituted with its LookUp text "test (2 records)". (Initiated by the same function/command, multiple times)
I cant reproduce this behaviour in this example project, i suppose its something asynchronous. In my project there are of course more columns, events, formating and other stuff..
(I tried some more, as u can see in the example project, like ViewModel add data at runtime by Task etc., dont know which is related.)
GreetingsJoerg
I'm not really sure what exactly you mean by sorting after a field and it randomly being before or after the display member is substituted. If I add a XamComboEditor to a Field as the editor and I give it the items source, once I run your code for sorting and grouping the field I don't see anything out of the ordinary. I don't notice anything being substituted. Can you take a look at my sample and modify it to reproduce your issue, then send it back to me?