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

How do I create a simple DataTemplate in C#?

$
0
0

I've been looking all morning to find some way of creating a simple, no data binding, data template. I've come across this article on Code Project titled Creating WPF Data Templates in Code: The Right Way quite often, but I believe it is overkill for what I'm trying to do. I'm trying to create a very simple, no databinding at all, data template which I want to use passing into a unit test. The referenced link goes into great detail about namespaces and the whole 9 yards. Something like this:

<DataTemplate><Grid><TextBlock Text="This is a test" /></Grid></DataTemplate>

So I think that article is giving me more than I need. So how do I accomplish this simply without pulling in everything including the kitchen sink?


Rod


Viewing all articles
Browse latest Browse all 18858

Trending Articles



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