Auto Size Textbox with text font change VS2013 in VB.net RRS feed

  • Question

  • Hi all,

    I try to set a textblock height and width to auto and after a font change read the new height and width as double values but I do not know how to set the "auto" property like I can in the editor.

    Thank you for your help

    Dim newtextblock As TextBlock
    Dim newsize As Integer = 16
    Dim newtext As String = "Test"
    Dim newwidth, newheight As Double

    newtextblock.FontSize = newsize
    newtextblock.FontWeight = Windows.UI.Text.FontWeights.Bold
    newtextblock.Text = newtext
    newtextblock.TextAlignment = TextAlignment.Center
    newtextblock.Height = "Auto"
    newtextblock.Width = "Auto"
    newheight = newtextblock.Height
    newwidth = newtextblock.Width

    • Edited by CM111 Tuesday, February 17, 2015 7:54 PM
    Tuesday, February 17, 2015 10:01 AM


All replies