@@ -18,48 +18,50 @@ Rendering the Image Editor in a dialog displays the component within a modal win
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>
2623
27- <SfDialog MinHeight="400px" Width="340px" Target="#target" ShowCloseIcon="true" @bind-Visible="Visibility">
28- <DialogTemplates>
29- <Content>
30- <div class="dialogContent">
31- <SfImageEditor @ref="ImageEditor" Height="300px">
32- </SfImageEditor>
33- </div>
34- </Content>
35- </DialogTemplates>
36- <DialogEvents OnOpen="@BeforeDialogOpen" Opened="OpenAsync" Closed="@DialogClosed"></DialogEvents>
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 void OpenDialogAsync ()
47+ private void OpenDialog ()
4548 {
46- this.Visibility = true;
49+ IsDialogVisible = true;
4750 }
4851
49- private async void OpenAsync ()
52+ private void OnDialogOpened ()
5053 {
51- await ImageEditor.OpenAsync("https://ej2.syncfusion.com/react/demos/src/image-editor/images/bridge.png");
52- ImageEditor.RefreshAsync();
54+ IsImageEditorOpened = true;
5355 }
5456
55- private void BeforeDialogOpen(Syncfusion.Blazor.Popups.BeforeOpenEventArgs args )
57+ private void OnDialogClosed( )
5658 {
57- this.ShowButton = false;
59+ IsImageEditorOpened = false;
5860 }
5961
60- private void DialogClosed(Syncfusion.Blazor.Popups.CloseEventArgs args )
62+ private async void OnImageEditorCreated( )
6163 {
62- this.ShowButton = true ;
64+ await ImageEditor.OpenAsync("https://ej2.syncfusion.com/react/demos/src/image-editor/images/bridge.png") ;
6365 }
6466}
6567```
0 commit comments