0

My XAML is here:

<Window.Resources>
    <XmlDataProvider x:Key="rssSource" XPath="//item" Source="https://news.google.com/news?output=rss" />
</Window.Resources>

I need to change it when button click event:

<Window.Resources>
    <XmlDataProvider x:Key="rssSource" XPath="//item" Source="CHANGE WITH TEXTBOX VALUE" />
</Window.Resources>

How can i do it?

1
  • Why would you need to do this? Are you trying to switch sources for one object at some point? Commented May 2, 2013 at 19:07

2 Answers 2

1

Inside the button click event put this line:

((XmlDataProvider)Resources["rssSource"]).Source = new Uri("<New Source>");
Sign up to request clarification or add additional context in comments.

Comments

0

Like this maybe

       XmlDataProvider provider = (XmlDataProvider) this.FindResource("rssSource");
       provider.Source = new Uri("CHANGE WITH TEXTBOX VALUE");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.