Expand|Select|Wrap|Line Numbers
- <Items>
- <Item>
- <Name>David</Name>
- <Age>20</Age>
- </Item>
- <Item>
- <Name>Marcus</Name>
- <Age>25</Age>
- </Item>
- <Item>
- <Name>George</Name>
- <Age>25</Age>
- </Item>
- </Items>
- <ComboBox Name="cb1" ItemsSource="{Binding Source={StaticResource myList}, XPath=Items/Item}" DisplayMemberPath="Name"/>
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 :
Expand|Select|Wrap|Line Numbers
- <Items>
- <Item>
- <Name>David</Name>
- <Age>20</Age>
- </Item>
- <Item>
- <Name>Marcus</Name>
- <Age>25</Age>
- </Item>
- <Item>
- <Name>George</Name>
- <Age>25</Age>
- </Item>
- <Item>
- <Name><![CDATA[Peter&#M]]></Name>
- <Age>25</Age>
- </Item>
- </Items>
Peter&#M
David
George
Marcus
Any idea what I can do to solve this problem?
Thanks.