textblock

Data binding the TextBlock.Inlines

两盒软妹~` 提交于 2019-11-26 06:02:59
问题 My WPF App receives a stream of messages from a backend service that I need to display in the UI. These messages vary widely and I want to have different visual layout (string formats, colors, Fonts, icons, whatever etc.) for each message. I was hoping to just be able to create an inline (Run, TextBlock, Italic etc) for each message then somehow put them all in a ObservableCollection<> and using he magic of WPF Data Binding on my TextBlock.Inlines in the UI. I couldn\'t find how to do this,

Any way to make a WPF textblock selectable?

↘锁芯ラ 提交于 2019-11-26 03:35:54
问题 I want to make the text displayed in the Witty, an open source Twitter client, selectable. It is currently displayed using a custom textblock. I need to use a TextBlock because I\'m working with the textblock\'s inlines to display and format the @username and links as hyperlinks. A frequent request is to be able to copy-paste the text. In order to do that I need to make the TextBlock selectable. I tried to get it to work by displaying the text using a read-only TextBox styled to look like a