1

I am working on an autocomplete search box in a Windows 8 app. The box needs to allow typing and then have text show up beyond the cursor, in a different color.

Our current approach is to layer one textbox on top of the other, but it seems to me like there could be a better way.

On iOS/Mac I could do this with an NSAttributedString, but I don't know if an equivalent like that exists on WinRT/.NET.

(For those that don't know, an NSAttributedString is a string that allows you to set attributes like color or size on different sections)

4

1 回答 1

0

我通常通过自动完成文本并将完成的部分标记为选中来解决这个问题,因此当用户继续输入时 - 所选部分将被输入的字符替换。我怀疑这会给您带来特定的视觉效果 - 没有突出显示,但更改了文本颜色,但我认为这是唯一可行且可靠的解决方案。

于 2013-09-09T19:14:42.147 回答