I have WPF aplication with a treeview that is bound to an XMLDataProvider in the XAML using HierarchicalDataTemplates. I'm trying to change the ItemsSource on the treeview at runtime because I don't know the xml filename until runtime.

What's the best way to go about doing something like this? I've tried the following which doesn't work.

XmlDataProvider dp = tree.FindResource("productsXml") as XmlDataProvider;
dp.Source = new Uri("file://products.xml");

Can you help me please? Thanks in advance.