XAML XML DataBinding does not work



I have a XML file like the fallowing:



<?xml version="1.0" encoding="utf-8" ?>
<Course
Title="jQueryAjax"
BtnAddisionalResourcesTitle=""
BtnAddisionalResourcesAddress="">
<Topic
Tag="ff"
Title="">

<Lesson
Tag=""
Title=""
Address=""
/>

<!--...-->


</Topic>

<!--...-->
</Course>


And also have a label like the fallowing



<Label
HorizontalAlignment="Right"
VerticalAlignment="Top"
FontSize="16pt"
FontFamily="Myriad Pro"
>
<Label.Content>
<Binding Source="{StaticResource CourseInfo}"
XPath="Title"
UpdateSourceTrigger="PropertyChanged"
/>
</Label.Content>
</Label>


And a XmlDataProvider in between:



<Window.Resources>
<XmlDataProvider x:Key="CourseInfo" Source="Settings\CourseScema.xml"/>
</Window.Resources>


but get this error as I listen using System.Diagnostics.TextWriterTraceListener:



System.Windows.Data Information: 41 : BindingExpression path error: '' property not `found for 'current item of collection' because data item is null. This could happen because the data provider has not produced any data yet. BindingExpression:Path=/; DataItem=null; target element is 'Label' (Name=''); target property is 'Content' (type 'Object')`


Any suggestions?


No comments:

Post a Comment