首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在accordion中浪费4个小时的文本块换行

在accordion中浪费4个小时的文本块换行
EN

Stack Overflow用户
提问于 2011-03-05 20:26:20
回答 1查看 349关注 0票数 1

为什么这不起作用:-

代码语言:javascript
运行
复制
<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>

我只能看到第一行。其余的内容将被裁剪。为什么即使我在textblock上有一个包装,height也不能自动设置?为什么这种控制让我如此困扰?我做错了什么?为什么我不能使用此控件获得正常的预期行为?

即使是这个最简单的标记也不起作用。

代码语言:javascript
运行
复制
<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>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-03-05 22:55:22

TextBlock中的文本不会换行,除非TextBlock也设置了Width

我采用了您的“最简单的标记”,将Width=1000添加到TextBlock中,并按我所期望的那样对文本进行了包装。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5203796

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档