c# - CollectionViewSource.SortDescriptions not work when binding items are created using Parallel -


i'm using vs2013, .net4.5, wpf desktop application.

xaml:

    <collectionviewsource x:key="cvs" source="{binding obspasses, mode=oneway}">         <collectionviewsource.sortdescriptions>             <scm:sortdescription propertyname="startdate"/>         </collectionviewsource.sortdescriptions>     </collectionviewsource> 

cs:

            this.obspasses = new observablecollection<passviewmodel>(             passes.asparallel().select(x => new passviewmodel(x))); 

if remove .asparallel(), items sorted, if added, items in disorder. feel little strange. doesn't sortdescription guarantee ui items sorted no matter in order items added in background?

in code demo didn't bind collectionviewsource, collection itself. try replacing

<itemscontrol itemssource="{binding obsfoos, mode=oneway}" > 

with

<itemscontrol itemssource="{binding source={staticresource cvs}}" > 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -