How to create a Tokenizing Control for UWP as know

2019-04-14 03:26发布

There is a great article about how to write a Tokenizing Control for WPF here: Tokenizing control – convert text to tokens

enter image description here

But how is this accomplished in an UWP App? The Windows 10 UWP Mail client does this just fine, so I know that it is possible. But how?

Tokenizing is super useful for To/CC/BCC input areas, as we know it from Outlook and lately from the Windows 10 UWP Mail client.

I suspect that RichTextBlock or maybe RichEditBox combined with AutoSuggestBox could be part of the answer, but in the WPF example above FlowDocument is used and FlowDocumet is not supported in UWP.

enter image description here

1条回答
甜甜的少女心
2楼-- · 2019-04-14 04:14

I haven't looked at their code. They likely have a text input control of their own, but you could achieve a fairly similar and possibly acceptable effect by putting (Rich)TextBox and "token" elements in a WrapPanel. You won't be able to easily select all text, but you could get clickable token elements. Otherwise - you might have a bit of work figuring out completely hand-crafted input and rendering.

查看更多
登录 后发表回答