Code Monkey home page Code Monkey logo

Comments (5)

dvoituron avatar dvoituron commented on July 25, 2024

You can add your property ShowLookUpButton to the Content object. Exactly as we sent the Id, Name and Age in the sample.

public record NameAndAge
{
    public int Id { get; set; }
    public string? Name { get; set; }
    public int Age { get; set; }
    public bool ShowLookUpButton { get; set; }    // 👈
}
[Parameter]
public DialogCustomizableExample.NameAndAge Content { get; set; } = default!;

from fluentui-blazor.

DanPanteraOut avatar DanPanteraOut commented on July 25, 2024

[Parameter]
public DialogCustomizableExample.NameAndAge Content { get; set; } = default!;

from fluentui-blazor.

vnbaaij avatar vnbaaij commented on July 25, 2024

Closing. Correct way of working explained.

from fluentui-blazor.

MarvinKlein1508 avatar MarvinKlein1508 commented on July 25, 2024

@dvoituron what about passing EventCallbacks?

from fluentui-blazor.

dvoituron avatar dvoituron commented on July 25, 2024

Have you tried anything? It's exactly the same:

Example adapting the Customized Dialog from our Demo website.

  1. Adding properties (an Action or an EventCallback)

    public record NameAndAge
    {
        public int Id { get; set; }
        public string? Name { get; set; }
        public int Age { get; set; }
        public Action<MouseEventArgs>? OnClick { get; set; }  // 👈
        public EventCallback<MouseEventArgs> OnClickCallback { get; set; }  // 👈
    }
  2. Initializing these properties

    protected override void OnInitialized()
    {
        DialogData.OnClick = (e) => { Console.WriteLine("Clicked"); };
        DialogData.OnClickCallback = EventCallback.Factory.Create<MouseEventArgs>(this, ShowDTMessage);
    }
    
    private void ShowDTMessage(MouseEventArgs e)
    {
        Console.WriteLine("Clicked on another button");
    }
  3. Using these new properties in the Dialog.

    <FluentDialogBody>
        <FluentButton OnClick="@(e => Content.OnClick?.Invoke(e) )">Click</FluentButton>
        <FluentButton OnClick="@Content.OnClickCallback">Click Callback</FluentButton>
    
        <FluentTextField @bind-Value="@Content.Name">Name:</FluentTextField>
        <FluentNumberField @bind-Value="@Content.Age">Age:</FluentNumberField>
    </FluentDialogBody>

from fluentui-blazor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.