Creating a Silverlight DataTemplate in code

前端 未结 4 1602
被撕碎了的回忆
被撕碎了的回忆 2020-11-29 08:08

How do I create a silverlight data template in code? I\'ve seen plenty of examples for WPF, but nothing for Silverlight.

Edit: Here\'s the code I\'m now using this f

4条回答
  •  广开言路
    2020-11-29 08:36

    I had a few problems with this code, getting element not foung exceptions. Just for reference, it was that I needed my namesspace included in the DataTemplate...

    private DataTemplate Create(Type type)
            {
                string xaml = @"
                    ";
                return (DataTemplate)XamlReader.Load(xaml);
            }
    

提交回复
热议问题