Skip to content

A WinForms helper for building Radzen Blazor DataGrid markup

Notifications You must be signed in to change notification settings

adamfoneil/RadzenGridHelper

Repository files navigation

This is a little WinForms app to help with creating Radzen DataGrid markup. The Radzen syntax is a little verbose IMO, so this helps remove the repeated content. I'm not complaining about Radzen's components, because their stuff is good and free. I just need a little more productivity when it comes to creating data grid functionality in Blazor. Having done it manually dozens of times now, I'm ready for a little tooling help. The need for this came up as I've been working on my show-and-tell Blazor project BlazorAO.

img

This is .NET5 WinForms app, which I'm very new to. I really like it, but my WinForms.Library is not compatible, so I had to build some new data binding helpers. That's what this new WinForms.Binding project is. This has the Save, New, and Open functionality. I also started a new ControlBinder class adapted from my old library. This new binder class is in its infancy, and I've only implemented a couple control types ToolStripTextBoxes and a new DataGridView handler.

You can see where I'm using my new binder in the main form here.

As for the markup generation, this is done with a few ingredients:

  • A special XmlElement class. Yes, C# has good XML support natively, but neither XElement nor XmlDocument were really simple enough for what I wanted.

  • A model class Grid is what my UI binds to and represents the markup output.

  • The grid markup itself is made by RadzenMarkup.BuildGrid. This builds XML in a particular way from a Grid object.

  • You can see sample output in the unit test for it.

I considered adding Reflection capability to make it easier to discover property names, but there's a big jump in complexity to make that all work nicely, so I'm stopping where I am now on this.

About

A WinForms helper for building Radzen Blazor DataGrid markup

Topics

Resources

Stars

Watchers

Forks

Languages