首页 > 解决方案 > 如何在 UWP 的 TextBox 中动态更改 OpenType 功能?

问题描述

我正在开发一个显示某些字体的演示文本的 UWP 应用程序。我想在演示文本中提供打开或关闭连字的选项。

就我而言,它适用于 TextBlocks 但不适用于 TextBoxes。我需要演示文本是可编辑的。

我的代码如下所示:

<TextBox
 Typography.StandardLigatures="{Binding ...}"
 Typography.DiscretionaryLigatures="{Binding ...}"
 Typography.ContextualLigatures="{Binding ...}"
 Typography.HistoricalLigatures="{Binding ...}"
 Text="This is a demo text fl fi ffl">

绑定是附加到某些 Toggleswitch 控件的 ViewModel 的布尔属性。

奇怪的是,如果您将TextBox更改为TextBlock,它会完美运行。

我知道这仅适用于受支持的字体,我使用的是兼容的字体,例如完全支持连字的 Palatino。

请如果你知道一些我不让我知道的事情

提前致谢。

标签: c#uwptypographyopentype

解决方案


推荐阅读