I'm trying to draw some markdown on a GraphicsView in .NET MAUI 7. Visual Studio is telling me that the function that draws markdown - canvas.DrawText - is not implemented.
I installed the NuGet package Microsoft.Maui.Graphics.Text.Markdig just as stated in Microsoft's guide. I don't know what could be causing this.
This is the part of my code that is causing the problem:
using Microsoft.Maui.Graphics.Text;
namespace MyProject;
public class MyGraphicStuff : IDrawable {
public void Draw(ICanvas canvas, RectF dirtyRect) {
canvas.Font = Microsoft.Maui.Graphics.Font.Default;
canvas.FontSize = 18;
canvas.FontColor = Colors.Blue;
string markdownText = @"*ABC*";
IAttributedText attributedText = MarkdownAttributedTextReader.Read(markdownText);
canvas.DrawText(attributedText, dirtyRect.Width / 2, dirtyRect.Height / 2, 40, 70); // The exception pops up here
}
}
I tried drawing something else here and it worked fine. There aren't even any red squiggly lines!
Edit:
This is the guide that I'm following: https://learn.microsoft.com/en-us/dotnet/maui/user-interface/graphics/draw#draw-attributed-text
I should also add that this pops up as a runtime error, not a compiler error.