Giter VIP home page Giter VIP logo

xaf-custom-view-item-blazor's Introduction

XAF Blazor - Use a Custom View Item to Add a Button to a Detail View

This example shows how to add a custom component to a Detail View. We add a button to a Detail View and display a message when a user clicks the button.

Implementation Details

  1. In the ASP.NET Core Blazor Module project, create a new Razor component and name it ButtonRenderer. In this component, configure the DxButton component, add the Create method that creates RenderFragment, and handle the Click event.

    Razor Component - CustomViewItem.Blazor.Server/Editors/ButtonViewItem/ButtonRenderer.razor

  2. Ensure that the component's Build Action property is set to Content.

  3. Create a ComponentModelBase descendant and name it ButtonModel. In this class, add properties and methods that describe your component.

    Component Model - CustomViewItem.Blazor.Server/Editors/ButtonViewItem/ButtonRenderer.razor

  4. In the ASP.NET Core Blazor Module project, create the ButtonDetailViewItemBlazor View Item and decorate it with the ViewItemAttribute to make this View Item appear in the Application Model's ViewItems node.

  5. Override the CreateControlsCore method to get a ButtonHolder instance. ButtonHolder returns a render fragment with our custom component. Note that in the XAF Blazor application, CreateControlsCore should return an instance that implements the IComponentContentHolder interface.

  6. Override the OnControlsCreated method. In this method, subscribe to the component model’s Click event. Implement the logic in the ComponentModel_Click event handler (in our example, the ShowMessage is called).

  7. Override the BreakLinksToControls method. In this method, unsubscribe from the component model’s Click event to release resources.

    Custom View Item - CustomViewItem.Blazor.Server/Editors/ButtonViewItem/ButtonDetailViewItemBlazor.cs.

See the following help topic for more information: How to: Use a Custom View Item to Add a Button to a Detail View.

Files to Look at

Documentation

More Examples

XAF - Add a Custom Button to a Form (WinForms and ASP.NET WebForms)

xaf-custom-view-item-blazor's People

Contributors

andreykozhevnikov avatar devexpressexamplebot avatar eugeniasimonova avatar merilstrayf avatar nikolaevairina avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

merilstrayf

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.