richtextblock

How to convert HTML to RTF in UWP

允我心安 提交于 2020-02-08 02:33:28
问题 I want to convert HTML to RichTextBlock in UWP. I found some answers in stackoverflow tried the code in following link link But when I try to bind html property in richtextblock controls it gives error saying The name "Properties" does not exist in the namespace "using XAMLHtml" I included following code to convert HTML to RTF in XAMLHtml.cs file class XAMLHtml { public class HtmlProperties : DependencyObject { public static readonly DependencyProperty HtmlProperty = DependencyProperty

Hyperlink in RichTextBlock makes the application crash on clicking

烂漫一生 提交于 2019-12-24 16:10:28
问题 in my Windows Phone 8.1 application I have a RichTextBlock with Hyperlinks in it. I've added some block of code in the click event of the Hyperlink. The problem is that whenever I click on the Hyperlink, my application crashes with an 'Access Violation' exception. This only happens when the keyboard is visible. If the keyboard is resigned then I do not get the exception. Also, this only happens on a WP8.1 device and not a W10 device. Below is my code. XAML <StackPanel> <RichTextBlock FontSize

UWP: Compute text height in a RichTextBlock gives weird results

一个人想着一个人 提交于 2019-12-24 07:30:48
问题 I need a reliable method to get the height of the text contained in a RichTextBlock , even before it is actually drawn on the scene. Using the normal Measure() method produces a weird result, as it can be seen in the MVCE: https://github.com/cghersi/UWPExamples/tree/master/MeasureText (I want to keep fiexed the width, and measure the final height, but the result of DesiredSize is far different from the actual height!!). For this reason, I found a rough method (mentioned here https:/

Auto detect URL, phone number, email in TextBlock

回眸只為那壹抹淺笑 提交于 2019-12-21 06:28:12
问题 I would like to automatically highlight URL, Email and phone number in UWP. It is possible in Android but it seems this features has been forgotten by Microsoft. In my use case, I get the text from a web service, so I don't know the text format which is a user text input on the web platform. 回答1: The platform is not supporting this feature (yet). When I've to do the same thing, I've ended with my own solution which is to: create an attached property receiving the text to format use some regex

RichTextBlock text line count

混江龙づ霸主 提交于 2019-12-12 05:43:07
问题 I am working on Windows Phone 8.1 application and I got this issue: I have a RichTextBlock control which holds my text, if my control height is bigger than my screen I need to scroll line by line automaticly while the user reads the text. Is there any way to determine the number of the lines in my RichTextBlock or geometric calculation is the only way? I've tried to iterate over the Blocks collection, but nothing seems to be relevant. The only thing that I've came with is by using TextPointer

Auto detect URL, phone number, email in TextBlock

北城余情 提交于 2019-12-03 22:19:54
I would like to automatically highlight URL, Email and phone number in UWP. It is possible in Android but it seems this features has been forgotten by Microsoft. In my use case, I get the text from a web service, so I don't know the text format which is a user text input on the web platform. Vincent The platform is not supporting this feature (yet). When I've to do the same thing, I've ended with my own solution which is to: create an attached property receiving the text to format use some regex to extract the URL, phone numbers, email addresses from it generate an Inlines collection which I'm

Convert simple HTML to a RichTextBlock

青春壹個敷衍的年華 提交于 2019-11-30 14:05:42
I am starting with Windows 8 and I am trying to convert HTML to a RichTextBlock . I have read that I could use this function : HtmlUtilities.ConvertToText in a TextBlock but I can't find a way to use this function in a RichTextBlock ! From what I understand and tried I can't extend the RichTextBlock so I can't apply this function everytime a RichTextBlock is called. Also, I can't find any way to bind text to a RichTextBlock and building a parser just for simple HTML (I only want paragraphs and italics/bolds) seems an overkill. Also, I have no idea where I should do this parsing since I the

Convert simple HTML to a RichTextBlock

痞子三分冷 提交于 2019-11-29 19:35:36
问题 I am starting with Windows 8 and I am trying to convert HTML to a RichTextBlock . I have read that I could use this function : HtmlUtilities.ConvertToText in a TextBlock but I can't find a way to use this function in a RichTextBlock ! From what I understand and tried I can't extend the RichTextBlock so I can't apply this function everytime a RichTextBlock is called. Also, I can't find any way to bind text to a RichTextBlock and building a parser just for simple HTML (I only want paragraphs