Windowscommunitytoolkit: MarkdownTextBlock have problems with table

Created on 25 Sep 2017  路  9Comments  路  Source: windows-toolkit/WindowsCommunityToolkit

The UWP Community Toolkit Sample App says it supports table,

image

But, during my test, my control version is 2.0.0, failed.

image

bug controls in progress

All 9 comments

It looks like you are missing a new line (return) character when setting the text. In xaml for example, that is 


image

Yeah, it works. But when I read from a txt file, the same problem comes again.

StorageFile sf3 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Attachment/Globalization.txt"));
using (Stream sr = await sf3.OpenStreamForReadAsync())
            {
                using (StreamReader read = new StreamReader(sr))
                {
                    textGlobalization.Text = await read.ReadToEndAsync();
                }
            }

My original txt is:

Language|Translators

:---|:---

Japanese|citydays

French|FAm

Russian|Kurbatov Vladimir

German|waiting for volunteers(Currently machine translation by Google)

Italian|waiting for volunteers(Currently machine translation by Google)

Portuguese|waiting for volunteers(Currently machine translation by Google)

Spanish|waiting for volunteers(Currently machine translation by Google)

Hindi|waiting for volunteers(Currently machine translation by Google)

...|...

I see, I believe the issue is caused by the line break, try to change the line break of the file to LF (instead of CRLF) and see if it works.

LF works :smile:
Thanks, @nmetulev . Hope this bug can be fixed soon.

@nmetulev I had the same issue for one of my prototypes and i was able to fix it by changing Line 228 of TableBlock.cs to if (pos < maxEndingPos && (markdown[pos] == '\n' || markdown[pos + 1] == '\n')). Basically i am also looking for next character as line feed for carriage return to complete the whole cell item. Works perfectly fine. Let me know if it is PR worthy.

Also note, this issue only happens when you load string from code behind. When you use it from xaml or Databinding a TextBox it works fine already.

Nice, how do you feel about submitting a PR?

@nmetulev Will do it on thursday. Except if i get a chance to do it before that.

@nmetulev ping

PR merged

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hermitdave picture hermitdave  路  58Comments

mvegaca picture mvegaca  路  49Comments

deltakosh picture deltakosh  路  55Comments

0pd picture 0pd  路  28Comments

Sergio0694 picture Sergio0694  路  48Comments