xaml - textblock not wrapping when set in code behind in background agent -


i'm making custom image in background agent on windows phone 8 display on of live tile. i've hit small problem, cannot text wrapping work.

i first create canvas, holds textblock. i've tried putting stackpanel in between no luck. set textwrapping wrap, set (max)height & (max)width on elements no luck. i've tried setting trimming none.

here's code:

        private void updateapptile(string message, int stuntcount)     {         system.threading.manualresetevent mre = new system.threading.manualresetevent(false);          deployment.current.dispatcher.begininvoke(() =>             {                 var can = new canvas();                 can.background = new solidcolorbrush(color.fromargb(255, 255, 204, 0));                 can.width = 336;                 can.height = 336;                 can.maxheight = 336;                 can.maxwidth = 336;                 textblock textblock = new textblock();                 textblock.fontsize = 26;                 textblock.foreground = new solidcolorbrush(color.fromargb(255, 51, 102, 153));                 textblock.textwrapping = textwrapping.wrap;                  textblock.padding = new thickness(10,10,10,10);                 textblock.maxheight = 336;                 textblock.maxwidth = 336;                 textblock.maxheight = 336;                 textblock.maxwidth = 336;                 textblock.texttrimming = texttrimming.none;                 textblock.text = message;                 stackpanel stackpanel = new stackpanel();                 stackpanel.maxheight = 336;                 stackpanel.maxwidth = 336;                 stackpanel.maxheight = 336;                 stackpanel.maxwidth = 336;                 stackpanel.children.add(textblock);                 can.children.add(stackpanel);                  const string livetilepath = "/shared/shellcontent/live_tile.jpg";                  var writeablebitmap = new writeablebitmap(336, 336);                 writeablebitmap.render(can, null);                 writeablebitmap.invalidate();                  using (                     var isofilestream = new isolatedstoragefilestream(livetilepath, filemode.openorcreate,                                                                       isolatedstoragefile.getuserstoreforapplication                                                                           ()))                 {                     writeablebitmap.savejpeg(isofilestream, 336, 336, 0, 100);                 }                  shelltile apptile = shelltile.activetiles.first();                 if (apptile != null)                 {                     fliptiledata tiledata = new fliptiledata                         {                             backbackgroundimage = new uri("isostore:" + livetilepath, urikind.absolute),                             backcontent = "",                             title = "set @ " + datetime.now.toshorttimestring()                         };                     tiledata.count = stuntcount;                     apptile.update(tiledata);                  }             });          mre.waitone();         notifycomplete();     } 

i have small problem image not finishing rendering/saving on time , tile showing older version, i'm still looking @ that.

thanks !

jorn


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -