Search Results

Search found 1 results on 1 pages for 'veechi'.

Page 1/1 | 1 

  • Textblock doesnt get updated when rendered in memory?

    - by veechi
    I have a text block which as part of a custom control.I added the custom control as a child of grid which in turn is added as child of a Canvas.All of these contorl are instantiated in memory and are not rendered on the UI.When I update the value of the TextBlock and emboss the canvas on an image, the updated value doesnt appear on the embossed image.Here is the code snippet:- System.Windows.Controls.Canvas embossCanvas = new System.Windows.Controls.Canvas(); System.Windows.Controls.Grid grid = new Grid(); MyControl myctrl= new MyControl(); int wd = (int)myctrl.ActualWidth; int ht = (int)myctrl.ActualHeight; embossCanvas.Width = wd; embossCanvas.Height = ht; grid.Children.Add(myctrl); embossCanvas.Children.Add(grid); myctrl.txtBlk.UpdateLayout(); grid.UpdateLayout(); embossCanvas.Measure(new System.Windows.Size(embossCanvas.Width, embossCanvas.Height)); embossCanvas.Arrange(new System.Windows.Rect(0, 0, embossCanvas.Width, (int)embossCanvas.Height)); embossCanvas.UpdateLayout(); RenderTargetBitmap renderBmp = new RenderTargetBitmap(wd, ht, 96, 96, System.Windows.Media.PixelFormats.Default); renderBmp.Render(embossCanvas);

    Read the article

1