Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃啎 feat(Dialog): add OutcomeContent with a DialogContentContext #1804

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

capdiem
Copy link
Contributor

@capdiem capdiem commented Mar 27, 2024

OutcomeContent which provides DialogContentContext similar to ChildContent allows accessing the OnClose method within the context.

Previously, it was necessary to use an additional variable in the dialog content to close the dialog:

<MDialog @bind-Value="dialog">
  <ActivatorContent>
    <MButton @attribtues="@context.Attrs">BUTTON</MButton>
  </ActivatorContent>
  <ChildContent>
    <p>content here...</p>
    <MButton OnClick="CloseDialog">Close</MButton>
  </ChildContent>
</MDialog>

@code {

  private bool dialog;

  private void CloseDialog() {
    dialog = false;
  }
}

Now you can:

<MDialog>
  <ActivatorContent>
    <MButton @attribtues="@context.Attrs">BUTTON</MButton>
  </ActivatorContent>
  <OutcomeContent>
    <p>content here...</p>
    <MButton OnClick="@context.Close">Close</MButton>
  </OutcomeContent>
</MDialog>

@duiapro duiapro merged commit 2e2b0fa into main Mar 27, 2024
2 checks passed
@duiapro duiapro deleted the feature/dialog-outcome branch March 27, 2024 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants