Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3333,6 +3333,11 @@
outside the dialog. Defaults to false.
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.DialogParameters.Visible">
<summary>
Gets or sets if a dialog is visible or nt (Hidden)
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.DialogParameters.PreventScroll">
<summary>
Prevents scrolling outside of the dialog while it is shown.
Expand Down
4 changes: 3 additions & 1 deletion src/Core/Components/Dialog/FluentDialog.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
public void Show()
{
Hidden = false;
Instance.Parameters.Visible = true;
RefreshHeaderFooter();
}

Expand All @@ -174,7 +175,8 @@ public void Show()
public void Hide()
{
Hidden = true;
RefreshHeaderFooter();
Instance.Parameters.Visible = false;
//RefreshHeaderFooter();
}

/// <summary>
Expand Down
5 changes: 4 additions & 1 deletion src/Core/Components/Dialog/FluentDialogProvider.razor
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
{
@foreach (DialogReference dialog in _internalDialogContext.References)
{
<FluentDialog @key="@dialog.GetKey()" Id="@dialog.Id" Instance="@dialog.Instance" Data="@dialog.Instance.Content" @ondialogdismiss=OnDismissAsync />
if (dialog.Instance.Parameters.Visible)
{
<FluentDialog @key="@dialog.GetKey()" Id="@dialog.Id" Instance="@dialog.Instance" Data="@dialog.Instance.Content" @ondialogdismiss=OnDismissAsync />
}
}
}
}
9 changes: 7 additions & 2 deletions src/Core/Components/Dialog/Parameters/DialogParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public class DialogParameters : ComponentParameters, IDialogParameters
/// </summary>
public bool PreventDismissOnOverlayClick { get; set; } = false;

/// <summary>
/// Gets or sets if a dialog is visible or not (Hidden)
/// </summary>
public bool Visible { get; set; } = true;

/// <summary>
/// Prevents scrolling outside of the dialog while it is shown.
/// </summary>to use
Expand Down Expand Up @@ -87,7 +92,7 @@ public class DialogParameters : ComponentParameters, IDialogParameters
/// <summary>
/// Gets or sets the height of the dialog. Must be a valid CSS height value like "600px" or "3em"
/// Only used if Alignment is set to "HorizontalAlignment.Center"
/// </summary>
/// </summary>
public string? Height { get; set; }

/// <summary>
Expand Down Expand Up @@ -121,7 +126,7 @@ public class DialogParameters : ComponentParameters, IDialogParameters
internal bool ShowPrimaryAction => !string.IsNullOrEmpty(PrimaryAction);

/// <summary>
/// Gets whether the secondary button is displayed or not. Depends on SecondaryAction having a value.
/// Gets whether the secondary button is displayed or not. Depends on SecondaryAction having a value.
/// </summary>
internal bool ShowSecondaryAction => !string.IsNullOrEmpty(SecondaryAction);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public interface IDialogParameters
DialogType DialogType { get; set; }
bool PreventScroll { get; set; }
bool PreventDismissOnOverlayClick { get; set; }
bool Visible { get; set; }
EventCallback<DialogResult> OnDialogResult { get; set; }
EventCallback<DialogInstance> OnDialogClosing { get; set; }
EventCallback<DialogInstance> OnDialogOpened { get; set; }
Expand Down