title: XMLDataprovider label binding codebehind WPF c#
body: <p>I am working on a WPF application. I set up a multilanguage with xml files and I use static resource binding in front code to set the corrisponding text. The issue I have is with doing the same thing in the codebehind. </p>
  
  <p>Here you can see how I use it in front code:</p>
  
  <pre><code>&lt;XmlDataProvider x:Key="Lang" Source="/lng/english.xml" XPath="WpfApplication"/&gt;
  &lt;Label HorizontalAlignment="Center" Margin="0,10,0,5" Foreground="White" FontWeight="Bold" Content="{Binding Source={StaticResource Lang}, XPath=MenuTextClimate/@Header}"&gt;&lt;/Label&gt;
  </code></pre>
  
  <p>I am trying to do the same in codebehind like this:</p>
  
  <pre><code>String selLangFullPath = WpfLibrary.LanguageOptions.getSelLangFullPath();
  XmlDataProvider xmlData = (XmlDataProvider)(this.FindResource("Lang"));
  xmlData.Source = new Uri(selLangFullPath, UriKind.Relative);
  xmlData.XPath = "MenuTextClimate/@Header";
  Binding NewBinding = new Binding();
  NewBinding.Source = xmlData;
  NewBinding.Mode = BindingMode.OneWay;
  NewBinding.XPath = "MenuTextClimate";
  lblTitle.SetBinding(Label.ContentProperty, NewBinding);
  </code></pre>
  
  <p>but for some reason it doesent seem to work. Can any one tell me where I went wrong?</p>
  
  <p>Thanks in advanced.</p>