Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Binding null when getting DataTemplate in code

$
0
0

Hi all

I'm trying to get a DatatTemplate from a ResourceDictionary in code. The problem is when I'm trying to save it to string I get all the Binding location to be either empty or null.

Here is my piece of code

    ResourceDictionary dictionary = new ResourceDictionary();
            dictionary.Source = new Uri("WpfApplication1;component/Dict.xaml", UriKind.RelativeOrAbsolute);
            DataTemplate template = (DataTemplate) dictionary["helloTextBox"];
            string save = XamlWriter.Save(template.LoadContent());

I'd be happy for any insight.

Thanks


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>