c# - WPF-WrapPanel 中的截止问题

标签 c# wpf xaml mvvm

当我在 wrap Panel 中使用多个控件时,如果任何控件包含冗长的文本(超过窗口大小),则会发生截断。 (见图)

cutoff happens for lengthy text block

我有两个文本 block 和一个按钮控件。

  <Grid>
        <WrapPanel>
            <TextBlock Text="Very long Text Message contains long text for testing " FontWeight="Bold"></TextBlock>
            <Button Content="sample Text"></Button>
            <TextBlock Text="sample Text  textblock"></TextBlock>

        </WrapPanel>
    </Grid>

截断发生在第一个文本 block 。如果文本包含更多字符,我想换行到下一行。

帮我解决问题。提前致谢。

最佳答案

您的文本框中需要属性 TextWrapping="Wrap"

<TextBlock 
   Text="Very long Text Message contains long text for testing " 
   FontWeight="Bold"   
   TextWrapping="Wrap">
</TextBlock>

关于c# - WPF-WrapPanel 中的截止问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20352350/

相关文章:

c# - 何时在 Prism 中加载数据合适

c# - 基于属性值的样式

wpf - WPF 绑定(bind)中单引号的用途是什么?

c# - 背景不会改变按钮 C# WPF

c# - 添加按钮单击 ="...."导致启动时出现 "Object reference not set to an instance of an object"

c# - DataTemplate 中的绑定(bind)命令

C# 3.5 ASP.net 文件 IO 问题,网络共享上的文件出现 UnauthorizedAccessException

c# - Com 调用 64 位服务器上的 32 位应用程序很慢

c# - 无需 Visual Studio 即可运行 Azure 计算模拟器和存储并启动网站

c# - 我们如何捕获 xamDataGrid 中的行删除通知?