I have a third party Blazor WebAssembly component with a width property that I want to set based on the width of a string that will be displayed within the component. How can I write a C# function that takes the string and calculates the width that it will render as and takes into account the CSS font values? Or can this only be done in JavaScript?
EDIT: I'd basically like to do this but in my Blazor C# code: Calculate text width with JavaScript