When I create re-usable components and controls, I pass in a "BasePage" [Parameter] so that I can call StateHasChanged() on the parent page (all pages inherit from BasePage) like this:
public void DoStateHasChanged()
{
this.StateHasChanged();//refresh all controls due to change in one control
}
Is there a way to do the same for the contents of a RadzenDialog while it's up and modal?
Workaround would be to keep a reference to the RenderFragment that was handed to the dialog (all of my components inherit from a "BaseComponent" (which inhrits Microsoft.AspNetCore.Components.ComponentBase) and call DoStateHasChanged() on it, but it would be nice (and logical?) to have an API on the DialogService that will call StateHasChanged on the parent-most-component-in-the-dialog so that we don't have to pass extra parameters that are not needed?
and it seems like this is only possible from a .razor file (and not a backing .razor.cs) due to the mixed content (it would be possible in code if we generate RenderFragment from code which is a pain) ... but anyway, works well this way (for automatically passing around any [CascadingParameter] ... it would still be nice if in the future you can provide an API "DialogService.DoStateHasChanged()" for this specific and very common need...
Another suggestion for DialogService: Provide a "CascadingParameterName" and "CascadingParameterValue" (or a Dictionary<string, object> CascadingParameters in a similar way that you already do of normal [Parameter]) and then you can wrap the main dialog component in the CascadingValue tags, and this way the dialog can be called from code in a cs file.
So the net sum of suggestions for DialogService (and I'm using it a lot):
Provide a DialogService.DoStateHasChanged() which will call StateHasChanged() on the top-most component in the dialog
Provide [CascadingParameter] support similar to the existing [Parameter] support
I don't think this is possible. There is no notion of "top-most component" in Blazor as far as I know. What if it is a HTML element which does not have StateHasChanged? I recommend using a separate page for the dialog and call its methods as needed.
The workaround you have found looks easy enough. Again I am not sure how a CascadingParameter could be implemented in a service.