locked
how to change the font color and size property in Code behind RRS feed

  • Question

  • Hi , 

    Is there any way to set the color and font propertry of dynamically added textblock control as below. 

    TextBlock tbPage1Desc = new TextBlock();
    tbPage1Desc.TextWrapping = TextWrapping.Wrap;

    tbPage1Desc.Text = e.Result[0].txtPageDesc;

    tbPage1Desc.Width = 500;

    tbPage1Desc.Height = 300;

     

    StackPanel1.Children.Clear();

    StackPanel1.Children.Clear();

    StackPanel1.Children.Add(tbPage1Title);

    Wednesday, March 4, 2009 5:10 AM

Answers

  •  

    tbPage1Desc .FontSize = 12;

    tbPage1Desc .FontFamily = new FontFamily("Verdana");

    tbPage1Desc..Foreground = new SolidColorBrush(Colors.Red);

     

    For More information refer the following site

    http://msdn.microsoft.com/en-us/library/cc189010(VS.95).aspx


    Wednesday, March 4, 2009 5:27 AM
  •  Hi,

    Looks like a duplicate post of http://silverlight.net/forums/t/77309.aspx

    You can set  ForeGround and font size property of textblock


    Wednesday, March 4, 2009 5:27 AM

All replies