C# WPF Change Resource On Click

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?

Answers


Like this maybe

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

Inside the button click event put this line:

((XmlDataProvider)Resources["rssSource"]).Source = new Uri("<New Source>");

Need Your Help

Getting Ids that have value all the same

sql join count

I have a table that has been left-joined from user Ids and another value:

Graph API returns email as null partially

email facebook-graph-api

We are developing a Facebook-App that retrieves the user's data via Graph API. We are suffering an odd situation where the emails of users are sometimes (ca. 25%) delivered by Facebook as null or e...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.