如何更新位于服务器上的XML文件时如何刷新XmlDataProvider?

时间:2012-07-06 18:07:20

标签: c# wpf data-binding xmldataprovider

在下面的代码中:当我更新myXml.xml时,有没有办法自动更新ComboBox.Items?

我知道'myXml.xml'是否是本地的,我可以使用像this这样的FileSystemWatcher。但是这个呢?

<Grid.Resources>
        <XmlDataProvider Source="http://www.mywebsite.com/myXml.xml" 
              x:Key="myXml"  XPath="/data/names"/>
</Grid.Resources>

<ComboBox ItemsSource="{Binding Source={StaticResource myXml}}"
              DisplayMemberPath="@name"/>

0 个答案:

没有答案