0

We try to realize a web-based UI using blazor. To make the first steps, we are trying to do the following:

  • Design a basic frontend
  • Create button for connection with a (local) mySQL database
  • Draw heatmap of stored positions (data visualization/picturebox)

Can blazor handle the Windows Forms PictureBox class? Or how do you show images which are generated by an internal function using blazor?

Thank you!

beinando
  • 477
  • 4
  • 18
  • 1
    Are you using blazor web assembly or server side? If the former, you are not going to be able to connect to the MySQL database without a server to act as an intermediary. And no, you cannot use a WinForms class like picture box in a blazor web app. – Kirk Woll Oct 13 '21 at 19:32
  • Blazor is rendered using HTML, which has ` – Jeremy Lakeman Nov 05 '21 at 03:18

1 Answers1

0

Images are displayed either adding an <img> tag or using a <div> tag with a css background image.

To add them dynamically, you'll need to use the tree builder:

@code
{    
  protected override void BuildRenderTree(RenderTreeBuilder builder)
  {
      base.BuildRenderTree(builder);
      builder.OpenElement(0, "img");
      builder.AddAttribute(1, "src", "/myawesomeimagefolder/myawesomeimage.png");
      builder.CloseComponent();
  }
}
sanepete
  • 979
  • 9
  • 28