问题
There is a great article about how to write a Tokenizing Control for WPF here: Tokenizing control – convert text to tokens
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.
回答1:
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.
来源:https://stackoverflow.com/questions/36237644/how-to-create-a-tokenizing-control-for-uwp-as-known-from-outlook-when-using-to