views:

6

answers:

1

Here is the code for App.xaml:

<!-- <XmlDataProvider x:Key="BookmarkData" Source="testData.xml" XPath="/Favourites"/>-->

<XmlDataProvider x:Key="BookmarkData" XPath="/Favorites">
    <x:XData>
        <Favorites>
            <Bookmark>
                <Title>Google</Title>
                <URL>http://www.google.com&lt;/URL&gt;
            </Bookmark>
            <Bookmark>
                <Title>Amazon</Title>
                <URL>http://www.amazon.com&lt;/URL&gt;
            </Bookmark>
            <Bookmark>
                <Title>Slashdot</Title>
                <URL>http://www.slashdot.com&lt;/URL&gt;
            </Bookmark>
            <Bookmark>
                <Title>Ars Technica</Title>
                <URL>http://www.arstechnica.com&lt;/URL&gt;
            </Bookmark>
            <Bookmark>
                <Title>New Egg</Title>
                <URL>http://www.newegg.com&lt;/URL&gt;
            </Bookmark>
        </Favorites>
    </x:XData>
</XmlDataProvider>

Commented out line isn't working. Path is correct.

Here is the XML file:

<Favorites>
        <Bookmark>
                  <Title>Google</Title>
                  <URL>http://www.google.com&lt;/URL&gt;
        </Bookmark>
        <Bookmark>
                  <Title>Amazon</Title>
                  <URL>http://www.amazon.com&lt;/URL&gt;
        </Bookmark>
        <Bookmark>
                  <Title>Slashdot</Title>
                  <URL>http://www.slashdot.com&lt;/URL&gt;
        </Bookmark>
        <Bookmark>
                  <Title>Ars Technica</Title>
                  <URL>http://www.arstechnica.com&lt;/URL&gt;
        </Bookmark>
        <Bookmark>
                 <Title>New Egg</Title>
                 <URL>http://www.newegg.com&lt;/URL&gt;
        </Bookmark>
</Favorites>

Why binding is happening in one case, but not the other?

A: 

The difference is in XPath. Compare

XPath="/Favourites"

with

XPath="/Favorites"
Athari
Right!! That's is funny. I haven't written the XML, just copied a sample from the web to save time, author is probably American and I am used to British English and I couldn't spot it for quite a long time. Thanks!
Vitalij