我有一個像休耕一個XML文件:XAML XML數據綁定不起作用
<?xml version="1.0" encoding="utf-8" ?>
<Course
Title="jQueryAjax"
BtnAddisionalResourcesTitle=""
BtnAddisionalResourcesAddress="">
<Topic
Tag="ff"
Title="">
<Lesson
Tag=""
Title=""
Address=""
/>
<!--...-->
</Topic>
<!--...-->
</Course>
,也有像休耕
<Label
HorizontalAlignment="Right"
VerticalAlignment="Top"
FontSize="16pt"
FontFamily="Myriad Pro"
>
<Label.Content>
<Binding Source="{StaticResource CourseInfo}"
XPath="Title"
UpdateSourceTrigger="PropertyChanged"
/>
</Label.Content>
</Label>
標籤和中間XmlDataProvider
:
<Window.Resources>
<XmlDataProvider x:Key="CourseInfo" Source="Settings\CourseScema.xml"/>
</Window.Resources>
但得到這個錯誤,因爲我跟蹤使用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')
有什麼建議嗎?