0

In my silverlight4/C# application, I have a comboBox which is bound to a DomainDataSource.

I'm adding some items in the runtime to that DomainDataSource to be shown in the comboBox, but I want to add some items in the beginning or in a specific index, not in the end.

Is there a chance to achieve that?

Thanks,

Hashem
  • 453
  • 1
  • 5
  • 17

1 Answers1

0

You can add a sort description to the DomainDataSource, so if you're inserting things which have a particular field value that means they're in the middle rather than the end then yes ... you can add items at specific places.

e.g.

<riaControls:DomainDataSource x:Name="source" QueryName="GetProducts" AutoLoad="true">
        <riaControls:DomainDataSource.DomainContext>
            <domain:ProductDomainContext />
        </riaControls:DomainDataSource.DomainContext>   
        <riaControls:DomainDataSource.SortDescriptors>
            <riaData:SortDescriptor PropertyPath="ProductID" Direction="Ascending" />
        </riaControls:DomainDataSource.SortDescriptors>
    </riaControls:DomainDataSource>
Mashton
  • 6,037
  • 2
  • 25
  • 35