tags:

views:

58

answers:

1

Normally, If i use the button in C# Windows form, and if the button text is too long, it will go to next line. (Eg. Very Happy, Happy will go to next line). But When i use wpf app in expression blend, the text will be truncated even though i set the auto size to false. (Eg. Very Happy, Happy will be truncated). Any advice would be really appreciated. Thank you.

+1  A: 

You need to place a TextBlock inside your button and set the TextWrapping attribute to Wrap.

Example:

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="WpfApplication1.MainWindow"
    x:Name="Window"
    Title="MainWindow"
    Width="640" Height="480">

    <Grid x:Name="LayoutRoot">
        <Button HorizontalAlignment="Left" VerticalAlignment="Top" Width="40" Height="40">
            <TextBlock Text="Very Happy" TextWrapping="Wrap" />
        </Button>
    </Grid>
</Window>
DanM
Thank you,it works.
David