I have a problem with TextBlock text selection (Windows Store apps, C#).
If I set IsTextSelectionEnabled = True
, then I can't Tap on the text.
I need to be able to open popup on taping text and select this text, but it seems like I can't do both.
Is there a way to have both - Text Selection and Tap - for one TextBlock?
Edited: I need Text Selection to be able copy text.
Edited: TextSelection and Copy feature works for multiple word text, where not every word is tappable.
Set TextBlock property
IsTextSelectionEnabled = True
Set text to
TextBlock
, usingTextBlock.Inlines
:textBlock.Inlines.Add(new Run() { Text = "Click " }); Hyperlink hyperlink = new Hyperlink(); hyperlink.Inlines.Add(new Run() { Text = "here" }); hyperlink.Click += hyperlink_Click; textBlock.Inlines.Add(hyperlink);
But if whole text is tappable, this solution doesn't help.
If I set text like this:
textBlock.Text = "Click here"; textBlock.Tapped += textBlock_Tapped;
Then I can't tap text. I can only copy this text.
If I set text like this:
Hyperlink hyperlink = new Hyperlink(); hyperlink.Inlines.Add(new Run() { Text = "Click here" }); hyperlink.Click += hyperlink_Click; textBlock.Inlines.Add(hyperlink);
Then I can't copy text. I can only tap on it.