Giter Site home page Giter Site logo

mry0 / blazor-winbox Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tameemhabash/blazor-winbox

0.0 0.0 0.0 1.51 MB

Multiple Windows Library that wraps winbox.js in Blazor Components

License: MIT License

JavaScript 5.46% C# 93.13% HTML 1.41%

blazor-winbox's Introduction

Blazor Winbox

Multiple Windows Library that wraps WinBox.js in Blazor Components.

Windows management and rendering processes were inspired by MudBlazor dialogs

Compatibility

Only Blazor WASM (client-side) .NET 6 applications are currently supported. This library is not tested on Blazor Server applications.

Getting Started

Installation:

The Nuget package page can be found here

To install Blazor.Winbox from Nuget Gallery simply search for its name and install the latest version


Or using Package Manager run the following command
Install-Package Blazor.Winbox
Or using .NET CLI run the following command
dotnet add package Blazor.Winbox

Configurations:

  • Import BlazorWinbox by adding the following in _Imports.razor
@using BlazorWinbox
  • Register Service in Program Class:
   using BlazorWinbox; 


   builder.Services.AddBlazorWinbox();
  • Add script references to index.html after Blazor script
<script src="_content/Blazor.Winbox/winbox.bundle.min.js"></script>
<script src="_content/Blazor.Winbox/BlazorWinbox.min.js"></script>
  • Add the following component to your MainLayout.razor
<WindowProvider />

Open a window

Create a window component. Let's use Counter template as example:

<Window>

    <h1>Counter</h1>

    <p role="status">Current count: @currentCount</p>

    <button class="btn btn-primary" @onclick="IncrementCount">Click me</button>

</Window>
@code {

    private int currentCount = 0;

    private void IncrementCount()
    {
        currentCount++;
    }
}

Note that whole window content should surrounded with <Window> Tag


To open window inject IWindowManager service and use Open<TComponent>() method:

//Use in razor
@inject IWindowManager windowManager
//OR in C# 
[Inject] public IWindowManager WindowManager { get; set; }

//Open a window
void OpenCounter(){
    IWindowReference windowReference = WindowManager.Open<Counter>();
}

Preview

blazor-winbox's People

Contributors

tameemhabash avatar

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.