What is the standard height of the text block?

In Silverlight and WPF, is there a default height for TextBlock, and if so, what is it?

+3
source share
3 answers
<Grid x:Name="LayoutRoot" Background="White">
    <Border BorderBrush="Blue" BorderThickness="1" CornerRadius="5">
        <TextBlock x:Name="Itself" Text="{Binding ElementName=Itself, Path=ActualHeight}" />
    </Border>
</Grid>

Given the aforementioned XAML, with Silverlight 4, TextBlock has a standard default font of 11 and ActualHeight of 16. The actual one shown by itself will be 0 due to the fact that the height is calculated too late.

Suppose you did not specify them, in which case they will not be used by default.

, XAML WPF, TextBlock . ( ) , ActualHeight 310. WPF , Silverlight ActualHeight. . , ( NaN).

+1

VS2008 23. ...

0

This is not real control, but an element of the structure. Therefore, the default height is the same as the control in which it is stored.

0
source

All Articles