Hi.
I have a combo box created using xaml. I bind the item source to a xml document.
<Items>
<Item><Name>David</Name>
<Age>20</Age>
</Item>
<Item><Name>Marcus</Name>
<Age>25</Age>
<Item><Name>George</Name>
</Items>
<ComboBox Name="cb1" ItemsSource="{Binding Source={StaticResource myList}, XPath=Items/Item}" DisplayMemberPath="Name"/>
I would like to sort the combobox items so that the items are displayd in ascending order.
I manage to sort the above list by using SortDescription as below :
SortDescription sd = new SortDescription("Name", ListSortDirection.Ascending);
cb1.Items.SortDescriptions.Add(sd);
The combobox will display the items in the following order.
David
George
Marcus
Now, when I add a node to the xml document, I added CData to handle invalid characters. The xml document will be updated as below :
<Item><Name><![CDATA[Peter&#M]]></Name>
When I do this, the sorting failed. The node with CData is always sorted to the top of the list.
Peter&#M
Any idea what I can do to solve this problem?
Thanks.