在手风琴文字块后面浪费第四个小时

时间:2011-03-05 12:26:20

标签: silverlight-4.0

为什么这不起作用: -

<toolkit:Accordion x:Name="___No_Name_"  Margin="0"  SelectionMode="OneOrMore" HorizontalAlignment="Stretch" VerticalAlignment="Top" Width="{Binding ActualWidth, ElementName=grid}"
                       >
        <toolkit:AccordionItem Header="Welcome" Margin="10,0" IsSelected="True" >
             <TextBlock Margin="3" TextWrapping="Wrap" Text="This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone " FontFamily="Verdana" FontSize="13.333" Foreground="#FF033C68"/>
        </toolkit:AccordionItem>
        <toolkit:AccordionItem Header="Family news" Margin="10,0" />
        <toolkit:AccordionItem Header="Random photos" Margin="10,0" />
        <toolkit:AccordionItem Header="News articles" Margin="10,0" />
    </toolkit:Accordion>

我只能看到第1行。其余内容将被剪裁。为什么即使我对文本块进行换行,高度也不会自动设置?为什么这种控制会如此骚扰我?我做错了什么?为什么我无法通过此控件获得正常的预期行为?

即使这个最简单的标记也行不通。

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" x:Class="SilverlightApplication3.MainPage"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">

        <toolkit:Accordion HorizontalAlignment="Stretch" Margin="0">
            <toolkit:AccordionItem  Header="Header">
                <TextBlock Text="This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a great system that allows anyone This site was created using FMT. This is a " TextWrapping="Wrap"/>
            </toolkit:AccordionItem>
        </toolkit:Accordion>

    </Grid>
</UserControl>

1 个答案:

答案 0 :(得分:1)

除非TextBlock也设置TextBlock,否则Width中的文字不会换行。

我采用了“最简单的标记”,将Width=1000添加到TextBlock,文字按照我的预期包装。