c# - wp8: programmatically created textblock is not displayed in app? -


well,

i have created textblock programmatically in c#. not displayed in app. whats wrong ?

here's updated c# code:

            double left = 0, top = 15, right = 0, bottom = 0;             double left1 = 0, top1 = 12, right1 = 0, bottom1 = 12;             textblock filename = new textblock();             filename.margin = new thickness(left, top, right, bottom);             filename.fontsize = 30;             filename.foreground = new solidcolorbrush(colors.white);             filename.textalignment = textalignment.center;             filename.text = "hello";             stackpanel content = new stackpanel();             content.margin = new thickness(left1, top1, right1, bottom1);             content.setvalue(grid.rowproperty, 0);             content.children.add(filename);; 

you've added textblock stackpanel haven't added stackpanel visual tree. assuming want add layoutroot, can this

layoutroot.children.add(content); 

as side note, there reason you're doing programmatically? depending on situation, might better off using usercontrol.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -