Creating the modal dialog project
The ModalDialog
project will be created by using the Empty Blazor WebAssembly App project template. We will add a Dialog
component that includes multiple sections, and use CSS isolation to apply styles that make it behave like a modal dialog. We will use EventCallback
parameters to communicate from the component back to the parent when a button is clicked. We will use RenderFragment
parameters to allow Razor markup to be communicated from the parent to the component. Finally, we will create a Razor class library and move our Dialog
component to it so that it can be shared with other projects.
Getting started with the project
We need to create a new Blazor WebAssembly app. We do this as follows:
- Open Visual Studio 2019.
- Click the Create a new project button.
- In the Search for templates (Alt + S) textbox, enter
Blazor
and hit the Enter key.The following screenshot shows the Empty Blazor WebAssembly App project template that we created...