Reputation: 304
I have a RichEditBox
in UWP
. I've enabled math mode API using the following statement.
LimitedAccessFeatures.TryUnlockFeature(...);
RichEditBox.TextDocument.SetMathMode(RichEditMathMode.MathOnly);
When I type multi-line in this RichEditBox
and call RichEditBox.TextDocument.GetText(TextGetOptions.FormatRtf, out string rtf)
and RichEditBox.TextDocument.SetText(TextSetOptions.FormatRtf, value)
, it throws the following exception.
System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
It also has the same behavior in multi-line when using RichEditBox.LoadFromStream(...)
and RichEditBox.SaveToStream(...)
.
And also when I type multi-line in this RichEditBox
and call RichEditBox.TextDocument.GetMath(out string math)
, math
returned an empty string. It works properly for single-line, but not multi-line.
RichEditBox
.AcceptsReturn
property to true
.RichEditBox
.RichEditBox
.
RichEditBox.TextDocument.GetText(TextGetOptions.FormatRtf, out string rtf)
RichEditBox.TextDocument.SetText(TextSetOptions.FormatRtf, value)
RichEditBox.LoadFromStream(...)
RichEditBox.SaveToStream(...)
I figured out how to get a rich text from that RichEditBox
using the following statement.
RichEditBox.TextDocument.SetMathMode(RichEditMathMode.NoMath);
RichEditBox.TextDocument.GetText(TextGetOptions.FormatRtf, out string rtf);
RichEditBox.TextDocument.SetMathMode(RichEditMathMode.MathOnly);
It works properly for RichEditBox.TextDocument.GetText(TextGetOptions, out string)
method. But it doesn't work for RichEditBox.TextDocument.SetText(TextSetOptions, string)
because if I call it, it sets only a line but not any characters. That means all character is set as '\0'
and line as '\n'
.
Upvotes: 0
Views: 104