tags:

views:

200

answers:

0

is there a way to insert an element to datatemplate in .cs file?

I created datatemplate and a control e.g. a textbox. I add the datatemplate to page resource but i could not see a method to add the textbox control to the data template.

My code is behind;

DataTemplate dt = new DataTemplate();
TextBlock tb = new TextBlock();
tb.Text = "{Binding BirtDate}";
// ... add textblock to datatemplate somes say TreeList in SL 3.0
// this is page
this.Resources.Add("datetemplate", dt);
dt.LoadContent();

Thanks for all help