We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Blazor equivalent of WPF ShowDialog()?

Thread ID:

Created:

Updated:

Platform:

Replies:

148976 Nov 10,2019 06:37 AM UTC Nov 11,2019 01:17 PM UTC Blazor 1
loading
Tags: Dialog
Frangoudes Panikos
Asked On November 10, 2019 06:37 AM UTC

1. Is there a way to call a dialog component e.x.  a confirmation dialog with yes/no options the way the ShowDialog() is used in wpf ?

2 .This means to create a single confirmation dialog component and then call it for code
3. The same, how can we call a component dynamically from another component in code ?

Thank you in advance
Panikos Frangoudes

Pandiyaraj Muniyandi [Syncfusion]
Replied On November 11, 2019 01:17 PM UTC

Hi Frangoudes, 
 
Greetings from Syncfusion support. 
 
Query 1: Is there a way to call a dialog component e.x.  a confirmation dialog with yes/no options the way the ShowDialog() is used in wpf ? 
 
Yes, we have public method “show()” method to display a dialog. 
 
 
 
Query 2: This means to create a single confirmation dialog component and then call it for code 
 
You can create a reusable dialog component and change its properties while rendering it in parent component through property binding as follows 
 
ReusableDialog.razor 
 
 
<EjsDialog> 
    <DialogTemplates> 
        <Header> @Header </Header> 
        <Content> @Content </Content> 
    </DialogTemplates> 
</EjsDialog> 
 
@code { 
    [Parameter] 
    public string Header { get; set; } = ""; 
    [Parameter] 
    public string Content { get; set; } = ""; 
} 
  
  
  
  
<ReusableDialog Header="@DlgHeader" Content="@DlgContent"></ReusableDialog> 
 
@code { 
    public string DlgHeader { get; set; } = ""; 
    public string DlgContent { get; set; } = ""; 
 
    this.DlgHeader = "Confirm"; 
    this.DlgContent = "Are you want to close this confirm Dialog ?"; 
} 
 
 
 
Query 3: The same, how can we call a component dynamically from another component in code ? 
 
Also, can call ChildComponent show() method from the parent component by taking child reference as follows 
 
ReusableDialog.razor 
 
 
<EjsDialog></EjsDialog> 
 
@code { 
    public void Show() 
    { 
        this.DialogObj.Show(); 
    } 
} 
 
 
 
Parent.razor 
 
 
<ReusableDialog @ref="ConfirmDialog"> </ReusableDialog> 
 
@code { 
    this.ConfirmDialog.Show(); 
} 
 
 
We have prepared sample for your reference with above use cases, get it from below link 
 
Regards, 
Pandiyaraj 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon