XBAP 选择页面文本

发布于 2024-08-17 06:01:51 字数 217 浏览 2 评论 0原文

接管了一个XBAP浏览器应用程序。对于某些剪贴板操作,选择 XBAP 而不是 HTML,并且该应用程序受到好评。

最近,一位用户询问为什么他不能像常规 HTML 页面一样选择屏幕文本(并复制到剪贴板)。哇,没有看到这一点,但完全明白它们来自哪里。

XBAP 应用程序有许多带有标签和信息文本块的表单。用户需要选择并复制该文本。

我有什么选择吗?我不想将数据移动到文本框。

Took over an XBAP browser application. XBAP was chosen over HTML for some clipboard actions, and the application was well received.

Recently a user asked why he cannot select screen text (and copy to clipboard) like a regular HTML page. Wow, didn't see that coming, but totally understand where they are coming from.

The XBAP application has many forms that have labels and textblocks of information. The user needs to select and copy this text.

Do I have any options? I don't want to move the data to textboxes.

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

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

发布评论

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

评论(1

可爱暴击 2024-08-24 06:01:51

AFAIK,您无法选择标签/文本块。这是一个古老的 Windows UI 传统。
您可以 样式文本框(如标签)

<Style x:Key="FauxLabel" TargetType="{x:Type TextBox}"> 
    <Setter Property="Background" Value="Transparent"/> 
    <Setter Property="BorderBrush" Value="{x:Null}"/> 
    <Setter Property="BorderThickness" Value="4"/> 
    <Setter Property="IsTabStop" Value="False"/> 
</Style>

或者您可以将部分 UI 更改为 WebBrowser 控件并为其提供正确的 HTML。在这种情况下,您会丢失细粒度的数据绑定,每次数据更改时都必须重新加载整个页面,并且它可能并不适合所有场景。但通常某些“报告”部分需要复制/粘贴,然后您可以以 HTML 格式制作此报告......

HTH。
我自己也想知道更好的方法=(

AFAIK, you can't make labels/textblocks selectable. It's an old Windows UI tradition.
You can either style textboxes like labels:

<Style x:Key="FauxLabel" TargetType="{x:Type TextBox}"> 
    <Setter Property="Background" Value="Transparent"/> 
    <Setter Property="BorderBrush" Value="{x:Null}"/> 
    <Setter Property="BorderThickness" Value="4"/> 
    <Setter Property="IsTabStop" Value="False"/> 
</Style>

or you can change part of your UI to the WebBrowser control and provide it with proper HTML. You lose fine-grained data bindings in that case, you'll have to reload that whole page on every data change, and it might not be suitable for every scenario. But usually copy/paste is needed for some "reporting" part, then you can make this report in the HTML format...

HTH.
I'd like to know better ways myself =(

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