Enterprise-level component library based on Bootstrap and Blazor
gitee
version
license
download
repo
commit
build
coverage

ListView

Provides rule arrangement controls

Demo

The <code>OnListViewItemClick</code> event is triggered when you click on the image

The list of products
Pic1.jpg
Pic2.jpg
Pic3.jpg
Pic4.jpg
Pic5.jpg
Pic6.jpg
Pic7.jpg
Pic8.jpg
Pic9.jpg
Pic10.jpg
Pic11.jpg
Pic12.jpg
Pic13.jpg
Pic14.jpg
Pic15.jpg
Pic16.jpg
Pic17.jpg
Pic18.jpg
Pic19.jpg
Pic20.jpg
Pic21.jpg
Pic22.jpg
Pic23.jpg
Pic24.jpg
Pic25.jpg
Pic26.jpg
Pic27.jpg
Pic28.jpg
Pic29.jpg
Pic30.jpg
Pic31.jpg
Pic32.jpg
Pic33.jpg
Pic34.jpg
Pic35.jpg
Pic36.jpg
Pic37.jpg
Pic38.jpg
Pic39.jpg
Pic40.jpg
Pic41.jpg
Pic42.jpg
Pic43.jpg
Pic44.jpg
Pic45.jpg
Pic46.jpg
Pic47.jpg
Pic48.jpg
Pic49.jpg
Pic50.jpg
Pic51.jpg
Pic52.jpg
Pic53.jpg
Pic54.jpg
Pic55.jpg
Pic56.jpg
Pic57.jpg
Pic58.jpg
Pic59.jpg
Pic60.jpg
Pic61.jpg
Pic62.jpg
Pic63.jpg
Pic64.jpg
Pic65.jpg
Pic66.jpg
Pic67.jpg
Pic68.jpg
Pic69.jpg
Pic70.jpg
Pic71.jpg
Pic72.jpg
Pic73.jpg
Pic74.jpg
Pic75.jpg
Pic76.jpg
Pic77.jpg
Pic78.jpg
Pic79.jpg
Pic80.jpg
Pic81.jpg
Pic82.jpg
Pic83.jpg
Pic84.jpg
Pic85.jpg
Pic86.jpg
Pic87.jpg
Pic88.jpg
Pic89.jpg
Pic90.jpg
Pic91.jpg
Pic92.jpg
Pic93.jpg
Pic94.jpg
Pic95.jpg
Pic96.jpg
Pic97.jpg
Pic98.jpg
Pic99.jpg
Pic100.jpg

Set the Pageable display paginated components

Demo
The list of products
Pic1.jpg
Pic2.jpg
Pic3.jpg
Pic4.jpg
Pic5.jpg
Pic6.jpg
Pic7.jpg
Pic8.jpg
Pic9.jpg
Pic10.jpg
Pic11.jpg
Pic12.jpg
Pic13.jpg
Pic14.jpg
Pic15.jpg
Pic16.jpg
Pic17.jpg
Pic18.jpg
Pic19.jpg
Pic20.jpg

Demo
The list of products
Group1
Pic4.jpg
Pic8.jpg
Pic12.jpg
Pic16.jpg
Pic20.jpg
Group2
Pic1.jpg
Pic5.jpg
Pic9.jpg
Pic13.jpg
Pic17.jpg
Group3
Pic2.jpg
Pic6.jpg
Pic10.jpg
Pic14.jpg
Pic18.jpg
Group4
Pic3.jpg
Pic7.jpg
Pic11.jpg
Pic15.jpg
Pic19.jpg

Attributes

Loading...

Methods

Loading...
@page "/listviews"
@inject IOptionsMonitor<WebsiteOptions> WebsiteOption
@inject IStringLocalizer<ListViews> Localizer

<h3>ListView</h3>

<h4>Provides rule arrangement controls</h4>

<DemoBlock Title="Basic usage" Introduction="" Name="Normal">
    <p>The <code>OnListViewItemClick</code> event is triggered when you click on the image</p>
    <div class="listview-demo">
        <ListView TItem="Product" Items="@Products" OnListViewItemClick="OnListViewItemClick">
            <HeaderTemplate>
                <div>The list of products</div>
            </HeaderTemplate>
            <BodyTemplate>
                <Card>
                    <CardBody>
                        <img src="@context.ImageUrl" />
                        <div class="listview-demo-desc">@context.Description</div>
                    </CardBody>
                </Card>
            </BodyTemplate>
            <FooterTemplate>
                <div class="text-end">
                    Coptyright Bootstrap Blazor
                </div>
            </FooterTemplate>
        </ListView>
    </div>
    <BlockLogger @ref="Trace" class="mt-3" />
</DemoBlock>

<DemoBlock Title="Paginated display" Introduction="Set the <code>Pageable</code> display paginated components" Name="Pagination">
    <div class="listview-demo">
        <ListView TItem="Product" Pageable="true" OnQueryAsync="@OnQueryAsync">
            <HeaderTemplate>
                <div>The list of products</div>
            </HeaderTemplate>
            <BodyTemplate>
                <Card>
                    <CardBody>
                        <img src="@context.ImageUrl" />
                        <div class="listview-demo-desc">@context.Description</div>
                    </CardBody>
                </Card>
            </BodyTemplate>
        </ListView>
    </div>
</DemoBlock>

<DemoBlock Title="" Introduction="" Name="Group">
    <div class="listview-demo">
        <ListView TItem="Product" GroupName="@(p => p.Category)" OnQueryAsync="@OnQueryAsync">
            <HeaderTemplate>
                <div>The list of products</div>
            </HeaderTemplate>
            <BodyTemplate>
                <Card>
                    <CardBody>
                        <img src="@context.ImageUrl" />
                        <div class="listview-demo-desc">@context.Description</div>
                    </CardBody>
                </Card>
            </BodyTemplate>
        </ListView>
    </div>
</DemoBlock>

<AttributeTable Items="GetAttributes()"></AttributeTable>

<MethodTable Items="GetMethods()"></MethodTable>
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/

using BootstrapBlazor.Components;
using BootstrapBlazor.Shared.Common;
using BootstrapBlazor.Shared.Components;

namespace BootstrapBlazor.Shared.Samples;

/// <summary>
/// 
/// </summary>
public sealed partial class ListViews
{
    private BlockLogger? Trace { get; set; }
    private IEnumerable<Product> Products { get; set; } = Enumerable.Empty<Product>();

    /// <summary>
    /// 
    /// </summary>
    protected override void OnInitialized()
    {
        base.OnInitialized();

        Products = Enumerable.Range(1, 100).Select(i => new Product()
        {
            ImageUrl = $"{WebsiteOption.CurrentValue.ImageLibUrl}/images/Pic{i}.jpg",
            Description = $"Pic{i}.jpg",
            Category = $"Group{(i % 4) + 1}"
        });
    }

    private Task<QueryData<Product>> OnQueryAsync(QueryPageOptions options)
    {
        var items = Products.Skip((options.PageIndex - 1) * options.PageItems).Take(options.PageItems);
        return Task.FromResult(new QueryData<Product>()
        {
            Items = items,
            TotalCount = Products.Count()
        });
    }
    private Task OnListViewItemClick(Product item)
    {
        Trace?.Log($"ListViewItem: {item.Description} clicked");
        return Task.CompletedTask;
    }

    private IEnumerable<AttributeItem> GetAttributes() => new AttributeItem[]
    {
        new AttributeItem(){
            Name = "Items",
            Description = Localizer["Items"],
            Type = "IEnumerable<TItem>",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem(){
            Name = "Pageable",
            Description = Localizer["Pageable"],
            Type = "bool",
            ValueList = "true|false",
            DefaultValue = "false"
        },
        new AttributeItem(){
            Name = "PageItemsSource",
            Description =Localizer["PageItemsSource"],
            Type = "IEnumerable<int>",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem(){
            Name = "HeaderTemplate",
            Description = Localizer["HeaderTemplate"],
            Type = "RenderFragment",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem(){
            Name = "BodyTemplate",
            Description = Localizer["BodyTemplate"],
            Type = "RenderFragment<TItem>",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem(){
            Name = "FooterTemplate",
            Description = Localizer["FooterTemplate"],
            Type = "RenderFragment",
            ValueList = " — ",
            DefaultValue = " — "
        },
        new AttributeItem() {
            Name = "OnQueryAsync",
            Description = Localizer["OnQueryAsync"],
            Type = "Func<QueryPageOptions, Task<QueryData<TItem>>>",
            ValueList = "—",
            DefaultValue = " — "
        },
        new AttributeItem() {
            Name = "OnListViewItemClick",
            Description = Localizer["OnListViewItemClick"],
            Type = "Func<TItem, Task>",
            ValueList = " — ",
            DefaultValue = " — "
        }
    };

    private IEnumerable<MethodItem> GetMethods() => new MethodItem[]
    {
        new MethodItem()
        {
            Name = "QueryAsync",
            Description = Localizer["QueryAsync"],
            Parameters = " — ",
            ReturnValue = "Task"
        }
    };
}

internal class Product
{
    public string ImageUrl { get; set; } = "";

    public string Description { get; set; } = "";

    public string Category { get; set; } = "";
}

B 站相关视频链接

暂无

交流群

QQ Group:BootstrapAdmin & Blazor 795206915 675147445 Welcome to join the group discussion
Themes
Bootstrap
Motronic
Ant Design (完善中)
LayUI (完善中)
An error has occurred. This application may no longer respond until reloaded. Reload
Seems like the connection with the server has been lost. It can be due to poor or broken network. Please hang on while we're trying to reconnect...
Oh snap! Failed to reconnect with the server. This is typically caused by a longer network outage, or if the server has been taken down. You can try to reconnect, but if that does not work, you need to reload the page.
Oh man! The server rejected the attempt to reconnect. The only option now is to reload the page, but be prepared that it won't work, since this is typically caused by a failure on the server.
Bootstrap Blazor 组件库 更新到 6.6.0

首先感谢您对本套组件的关注,本目前本套组件已经拥有超过 120 个组件,本组件是基于 Bootstrap 风格的 Blazor 企业级组件库,提供如布局、导航、表单、数据、通知、图标、语音等几大类通用组件,每一个组件都经过静心设计,具有模块化、响应式和优秀的性能。从更多实际场景出发,满足多种场景的需求,极大的减少开发者时间成本,大大缩短开发周期,大幅提高开发效率,并提供了一套 通用权限管理系统 示例工程。Bootstrap Blazor 产品是由一支专业的全职技术团队进行维护,高效的响应速度,多元化的解决方案,长期提供支持,并提供企业级支持。目前已在多家知名国企内部使用,项目最高在线 1200 人稳定运行。右侧为国内人数最多的中文 Blazor QQ 社区二维码,欢迎扫描加群。

组件更新到 6.6.0 更新日志 [传送门] 如果组件给您带来了方便,请您帮忙给项目点亮 Star github gitee

QQGroup
QQ 795206915