@@ -18,47 +18,50 @@ Rendering the Image Editor in a dialog involves displaying the image editor comp
1818@using Syncfusion.Blazor.Inputs
1919
2020<div style="padding-bottom: 15px">
21- @if (this.ShowButton)
22- {
23- <SfButton OnClick="OpenDialogAsync">Open Image</SfButton>
24- }
21+ <SfButton OnClick="OpenDialog">Edit Image</SfButton>
2522</div>
26- <SfDialog Height="75%" Width="435px" Target="#target" ShowCloseIcon="true" @bind-Visible="Visibility">
27- <DialogTemplates>
28- <Content>
29- <div class="dialogContent">
30- <SfImageEditor @ref="ImageEditor" Height="400px">
31- </SfImageEditor>
32- </div>
33- </Content>
34- </DialogTemplates>
35- <DialogEvents OnOpen="@BeforeDialogOpen" Opened="OpenAsync" Closed="@DialogClosed"></DialogEvents>
3623
37- </SfDialog>
24+ <div class="control-section" id="target" style="height: 500px">
25+ <SfDialog Width="600px" Height="500px" Target="#target" ShowCloseIcon="true" @bind-Visible="IsDialogVisible">
26+ <DialogEvents Opened="OnDialogOpened" Closed="OnDialogClosed"></DialogEvents>
27+ <DialogTemplates>
28+ <Content>
29+ <div class="dialog-content">
30+ @if (IsImageEditorOpened)
31+ {
32+ <SfImageEditor @ref="ImageEditor" Height="400px">
33+ <ImageEditorEvents Created="OnImageEditorCreated"></ImageEditorEvents>
34+ </SfImageEditor>
35+ }
36+ </div>
37+ </Content>
38+ </DialogTemplates>
39+ </SfDialog>
40+ </div>
3841
3942@code {
40- private bool Visibility { get; set; } = false;
41- private bool ShowButton { get; set; } = true ;
42- SfImageEditor ImageEditor;
43+ private bool IsDialogVisible { get; set; } = false;
44+ private bool IsImageEditorOpened { get; set; } = false ;
45+ private SfImageEditor ImageEditor;
4346
44- private async void OpenDialogAsync()
45- {
46- this.Visibility = true;
47+ private void OpenDialog()
48+ {
49+ IsDialogVisible = true;
4750 }
4851
49- private async void OpenAsync()
50- {
51- await ImageEditor.OpenAsync("https://ej2.syncfusion.com/react/demos/src/image-editor/images/bridge.png");
52+ private void OnDialogOpened()
53+ {
54+ IsImageEditorOpened = true;
5255 }
5356
54- private void BeforeDialogOpen(BeforeOpenEventArgs args )
57+ private void OnDialogClosed( )
5558 {
56- this.ShowButton = false;
59+ IsImageEditorOpened = false;
5760 }
5861
59- private void DialogClosed(CloseEventArgs args )
62+ private async void OnImageEditorCreated( )
6063 {
61- this.ShowButton = true ;
64+ await ImageEditor.OpenAsync("https://ej2.syncfusion.com/react/demos/src/image-editor/images/bridge.png") ;
6265 }
6366}
6467```
0 commit comments