TextBlock的宽度和高度

TextBlock的宽度和高度

本文介绍了WPF TextBlock的宽度和高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨当Height"Auto"时,我无法访问TextBlock控件的高度.

HiI can''t access the Height of TextBlock control when It''s Height is "Auto".

TextBlock t = new TextBlock()
{
    Width = 280,
    TextWrapping = System.Windows.TextWrapping.Wrap,
    FontSize = 12,
    Tag = foundClosureDay.CurrentDate,
    ToolTip = Persians.JulianToHijri(foundClosureDay.CurrentDate).DateToString
};
t.Text = "bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla ";

double height = t.Height;

height = t.ActualHeight;




请帮助我,t.Heightt.ActualHeight都不起作用.




Please help me, both t.Height and t.ActualHeight don''t work.

推荐答案



这篇关于WPF TextBlock的宽度和高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 23:56