Markdown.Avalonia icon indicating copy to clipboard operation
Markdown.Avalonia copied to clipboard

a9 not working with preview5 on Linux

Open ShinyZero0 opened this issue 1 year ago • 3 comments

I have installed the 11.0.0-a9 (nuget couldn't find a10) version which should be compatible with Avalonia 11.0.0-preview5 and i'm using .NET 7.0 (6.0 didn't work too) on Fedora 37 Linux. I have tried to bind the strings from my project inside of ListBox DataTemplate but there was nothing instead of markdown view. Then i created an empty project and pasted the example from wiki but it just rendered some plaintext mess. It was unselectable as the md view should be as i read there. I have tried Simple theme instead of Fluent but that didn't help. The only warning i got is some old package for .NET Framework was installed:

    /home/zero/dev/CSharp/Avalonia/TestMarkdown/TestMarkdown.csproj : warning NU1701: Package 'HarfBuzzSharp.NativeAssets.Linux 2.8.2.1-preview.108' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net7.0'. This package may not be fully compatible with your project.
    /home/zero/dev/CSharp/Avalonia/TestMarkdown/TestMarkdown.csproj : warning NU1701: Package 'HarfBuzzSharp.NativeAssets.macOS 2.8.2.1-preview.108' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net7.0'. This package may not be fully compatible with your project.
    /home/zero/dev/CSharp/Avalonia/TestMarkdown/TestMarkdown.csproj : warning NU1701: Package 'HarfBuzzSharp.NativeAssets.Win32 2.8.2.1-preview.108' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net7.0'. This package may not be fully compatible with your project.

ShinyZero0 avatar Mar 05 '23 19:03 ShinyZero0

Sorry, This is 11.0.0-preview5 issue. For now, the way to write directly in xaml requires xml:space="preserve" in Avalonia11.

<md:MarkdownScrollViewer xml:space="preserve">
    # Heading1

    Hello Markdown.Avalonia!

    * listitem1
    * listitem2

    | col1 | col2 | col3 |
    |------|------|------|
    | one  |------|------|
    | two  |------|------|

</md:MarkdownScrollViewer>

I will update wiki and try to modify the package.

I prepared a sample to display Md on ListBox DataTemplate. I'm glad if you can use it as a reference.

AvaloniaListBoxTemplate/Views/MainWindow.axaml AvaloniaListBoxTemplate/ViewModels/MainWindowViewModel.cs

whistyun avatar Mar 07 '23 12:03 whistyun

Did you fix something in Nuget package? Last time i think i was doing the same as in your example and it wasn't working, but now it works well. Anyway thanks, your work is cool!

ShinyZero0 avatar Mar 07 '23 17:03 ShinyZero0

I can't change a package that has already been published in nuget.org. So a9 has not been changed since its publication date.

Note that the sample I wroted doesn't monitor property changes, So changes (adding, deleting, or modifying items to the list) are not reflected on the screen. If you want to monitor property changed, a list property type should be ObservableCollection<T> instead of List<T> and an item class should implement INotifyPropertyChanged.

whistyun avatar Mar 08 '23 15:03 whistyun