Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] MarkdownTextBlock #6

Closed
ghost1372 opened this issue Nov 14, 2020 · 13 comments
Closed

[Feature Request] MarkdownTextBlock #6

ghost1372 opened this issue Nov 14, 2020 · 13 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ghost1372
Copy link

Hi Can you port MarkdownTextBlock from WindowsCommunityToolkit to WPF?
https://docs.microsoft.com/en-us/windows/communitytoolkit/controls/markdowntextblock
https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Markdown

@ShankarBUS
Copy link
Member

It is already here!

Directory in this repo:
https://github.com/ModernWpf-Community/ModernWpfCommunityToolkit/tree/master/ModernWpf.Toolkit.UI.Controls.Markdown

NuGet package:
https://www.nuget.org/packages/ModernWpf.Toolkit.UI.Controls.Markdown/

TBH it was the first control I ported from WindowsCommunityToolkit which led me to create this toolkit!

Thanks for asking though 😄.

@ShankarBUS ShankarBUS self-assigned this Nov 14, 2020
@ShankarBUS ShankarBUS added enhancement New feature or request good first issue Good for newcomers labels Nov 14, 2020
@ghost1372
Copy link
Author

@ShankarBUS thank you❤
one more question😁
Is it possible to load the Md file from path?

@ShankarBUS
Copy link
Member

You kind of can.

But you need to manually read the file content and load it into the text property.

See this for reference:

private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
string initialmd = GetInitialMD();
EditorBox.Text = initialmd;
}
private string GetInitialMD()
{
string output = "";
output = File.ReadAllText("InitialContent.md");
return output;
}

@ghost1372
Copy link
Author

@ShankarBUS thank you for your help
i think there is a bug because # cant be rendered or i miss something?
Untitled

@ShankarBUS
Copy link
Member

ShankarBUS commented Nov 14, 2020

# test should render

test

I guess there are some problems with themeing?
It could be white in color. Could you try selecting the text on it?

@ghost1372
Copy link
Author

# test should render

test

I guess there are some problems with themeing?

yes Header1Foreground="Red" fixed
tnx again

@ShankarBUS
Copy link
Member

Oh great!

I forgot one thing.
The control doesn't have the necessary theme resources built-in.
Some resources have to be added manually to the App.xaml.

See this for referrence:
https://github.com/ShankarBUS/ModernFlyouts/blob/b852f6cc7a4e6a207012251cec5ff90e82da5d75/ModernFlyouts/App.xaml#L10-L47

@ghost1372
Copy link
Author

Great now all styles loaded👍👍

@ShankarBUS
Copy link
Member

You're my first customer 🤣. Even I couldn't use it my own app 😔. Thanks for giving it a try!

@ShankarBUS
Copy link
Member

@ghost1372,

In case you're still interested in using this toolkit, I want you to know that this toolkit is stable and is ready to be used in other projects.

v0.1 release is out now on Nuget. The setup process is so simple now.

What you need to do in order to use the MarkdownTextBlock is

  1. Install the ModernWpfUI nuget package and follow the instructions provided with it.
  2. Install the ModernWpf.Toolkit.UI.Controls.Markdown nuget package.
  3. Add these to your App.xaml
    xmlns:toolkit="http://schemas.modernwpf.com/toolkit"
    <ui:ThemeResources>
    <ui:ThemeResources.ThemeDictionaries>
    <ResourceDictionary x:Key="Light" ui:ThemeDictionary.Key="Light" toolkit:ToolkitThemeDictionary.Key="Light" />
    <ResourceDictionary x:Key="Dark" ui:ThemeDictionary.Key="Dark" toolkit:ToolkitThemeDictionary.Key="Dark" />
    <ResourceDictionary x:Key="HighContrast" ui:ThemeDictionary.Key="HighContrast" toolkit:ToolkitThemeDictionary.Key="HighContrast" />
    </ui:ThemeResources.ThemeDictionaries>
    </ui:ThemeResources>

That's it!

For reference you could check up the ModernWpf.Toolkit.SampleApp project.

If you have dropped the idea of using this toolkit, no problems I understand. I just wanted you to know since you seemed to be interested in using this toolkit 😃.

@ghost1372
Copy link
Author

I'm still interested in this project. Thank you for letting me know.
I recently created an unofficial version of ModernWpf that is not dependent on WinRT
Can I add this control to my unofficial version?

@ShankarBUS
Copy link
Member

Do whatever you want!

But don't forget to attribute the .NET foundation. Some good MS employee suggested me to do it so that we could avoid any licensing issues. I would recommend you to do so.

@ghost1372
Copy link
Author

Thank you, I will definitely consider it.❤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants