WPF 设计器查看刺激 - 没有文本换行

发布于 2024-08-22 19:13:05 字数 446 浏览 2 评论 0原文

我不确定是否有解决方案。但这让我烦恼,让我恼火。

我正在使用 WPF 和 Visual Studio 2008。我设计了一个漂亮的 UI :)。我有一个帮助文本控件,它与单击的控件相关。当应用程序首次加载时,它会设置默认文本。 “欢迎来到 X 屏幕,在这里你可以......”。它位于用户控件内,该控件位于窗口内的选项卡控件内。用户控件设置了 minheight 和 minwidth (我怀疑这就是设计器这样做的原因)。

我在 XAML 中设置了初始文本,并将 textwrapping 设置为 true。问题是设计师决定将所有这些都放在一行上 - 这确实会破坏视图(我无法在一个屏幕上以 100% 的比例看到整个 UI,如果我将其缩小,我将无法阅读内容,等等)

有没有办法解决这个问题(除了在代码中设置文本之外 - (这样做和在 xaml 中这样做有什么区别吗?!)) 也许这是唯一的解决办法。

感谢您的阅读。

I'm not sure if there is a solution to this. But it is niggling at me and irritating me.

I'm using WPF and Visual Studio 2008. I've designed a beautiful UI :). I have a help text control which is contextual as to which control has been clicked. When the app first loads it has default text set. "Welcome to the X screen here you can ..........". This is inside a user control, which sits inside a tab control, inside a window. The user control has minheight and minwidth set (I suspect this is why the designer does what it does).

I set the initial text in the XAML, with textwrapping set to true. The problem is that the designer decides to put this all on one line - which really throws out the view (I can't see the entire UI in one screen at 100%, if I scale it down I can't read things, etc)

Is there anyway to get around this (other than setting the text in the code instead - (is there any difference between doing this and doing it in the xaml?!))
Maybe that is the only solution.

Thanks for reading.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凉风有信 2024-08-29 19:13:05

试试这个:

<TabControl>
  <TabItem MaxWidth="200">
    <TabItem.Header>
      <TextBlock TextWrapping="Wrap">
        hi asdfkjl; asdf asdf asdf sdaf sadf  safd sf   sadf  fasf asd f asdf as df sadf asd f asdf sd f sadf as df asdf asd f asdf as df
      </TextBlock>
    </TabItem.Header>
  </TabItem>
</TabControl>

我在 kaxaml 中测试了它,它像您期望的那样包装。

Try this:

<TabControl>
  <TabItem MaxWidth="200">
    <TabItem.Header>
      <TextBlock TextWrapping="Wrap">
        hi asdfkjl; asdf asdf asdf sdaf sadf  safd sf   sadf  fasf asd f asdf as df sadf asd f asdf sd f sadf as df asdf asd f asdf as df
      </TextBlock>
    </TabItem.Header>
  </TabItem>
</TabControl>

I tested it in kaxaml and it wraps like you'd expect it to.

独夜无伴 2024-08-29 19:13:05

您是否考虑过为此使用 FlowDocumentReader 控件?我没有遇到您所描述的问题,但此控件对于我呈现帮助文本非常有用。

Have you considered using a FlowDocumentReader control for this? I haven't experienced the problem you described but this control was very useful for me to render help text.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文