- Antarctica
- United Arab Emirates
- Afghanistan
- Albania
- Armenia
- Curacao
- Sint Maarten
- Netherlands Antilles
- Angola
- Argentina
- Australia
- Cocos Islands
- Christmas Island
- Heard Island and McDonald Islands
- Kiribati
- Norfolk Island
- Nauru
- Tuvalu
- Aruba
- Azerbaijan
- Bosnia and Herzegovina
- Barbados
- Bangladesh
- Bulgaria
- Bahrain
- Burundi
- Bermuda
- Brunei
- Bolivia
- Brazil
- Bahamas
- Bhutan
- Botswana
- Belarus
- Belize
- Canada
- Democratic Republic of the Congo
- Switzerland
- Liechtenstein
- Chile
- China
- Colombia
- Costa Rica
- Cuba
- Cape Verde
- Czech Republic
- Djibouti
- Denmark
- Faroe Islands
- Greenland
- Dominican Republic
- Algeria
- Egypt
- Eritrea
- Ethiopia
- Andorra
- Austria
- Aland Islands
- Belgium
- Saint Barthelemy
- Cyprus
- Germany
- Estonia
- Spain
- Finland
- France
- French Guiana
- Guadeloupe
- Greece
- Ireland
- Italy
- Kosovo
- Luxembourg
- Monaco
- Montenegro
- Saint Martin
- Martinique
- Malta
- Netherlands
- Saint Pierre and Miquelon
- Portugal
- Reunion
- Slovenia
- Slovakia
- San Marino
- French Southern Territories
- Vatican
- Mayotte
- Fiji
- Falkland Islands
- United Kingdom
- Guernsey
- South Georgia and the South Sandwich Islands
- Isle of Man
- Jersey
- Georgia
- Ghana
- Gibraltar
- Gambia
- Guinea
- Guatemala
- Guyana
- Hong Kong
- Honduras
- Croatia
- Haiti
- Hungary
- Indonesia
- Israel
- Palestinian Territory
- India
- Iraq
- Iran
- Iceland
- Jamaica
- Jordan
- Japan
- Kenya
- Kyrgyzstan
- Cambodia
- Comoros
- North Korea
- South Korea
- Kuwait
- Cayman Islands
- Kazakhstan
- Laos
- Lebanon
- Sri Lanka
- Liberia
- Lesotho
- Lithuania
- Latvia
- Libya
- Western Sahara
- Morocco
- Moldova
- Madagascar
- Macedonia
- Myanmar
- Mongolia
- Macao
- Mauritania
- Mauritius
- Maldives
- Malawi
- Mexico
- Malaysia
- Mozambique
- Namibia
- Nigeria
- Nicaragua
- Bouvet Island
- Norway
- Svalbard and Jan Mayen
- Nepal
- Cook Islands
- Niue
- New Zealand
- Pitcairn
- Tokelau
- Oman
- Panama
- Peru
- Papua New Guinea
- Philippines
- Pakistan
- Poland
- Paraguay
- Qatar
- Romania
- Serbia
- Serbia and Montenegro
- Russia
- Rwanda
- Saudi Arabia
- Solomon Islands
- Seychelles
- Sudan
- Sweden
- Singapore
- Saint Helena
- Sierra Leone
- Somalia
- Suriname
- South Sudan
- Sao Tome and Principe
- Syria
- Swaziland
- Thailand
- Tajikistan
- Turkmenistan
- Tunisia
- Tonga
- Turkey
- Trinidad and Tobago
- Taiwan
- Tanzania
- Ukraine
- Uganda
- American Samoa
- Bonaire, Saint Eustatius and Saba
- Ecuador
- Micronesia
- Guam
- British Indian Ocean Territory
- Marshall Islands
- Northern Mariana Islands
- Puerto Rico
- Palau
- El Salvador
- Turks and Caicos Islands
- East Timor
- United States Minor Outlying Islands
- United States
- British Virgin Islands
- U.S. Virgin Islands
- Uruguay
- Uzbekistan
- Venezuela
- Vietnam
- Vanuatu
- Samoa
- Central African Republic
- Republic of the Congo
- Cameroon
- Gabon
- Equatorial Guinea
- Chad
- Antigua and Barbuda
- Anguilla
- Dominica
- Grenada
- Saint Kitts and Nevis
- Saint Lucia
- Montserrat
- Saint Vincent and the Grenadines
- Burkina Faso
- Benin
- Ivory Coast
- Guinea-Bissau
- Mali
- Niger
- Senegal
- Togo
- New Caledonia
- French Polynesia
- Wallis and Futuna
- Yemen
- South Africa
- Zambia
- Zimbabwe
Blazorise List View component
List views are a flexible and powerful component for displaying a series of content in a contained scrollable view by providing a data source.
List views use ListGroup
behind the covers, so you may make use of the ListGroup
underlying APIs.
Examples
Basic
<ListView TItem="Country" Data="Countries" TextField="(item) => item.Name" ValueField="(item) => item.Iso" Mode="ListGroupMode.Static" MaxHeight="300px"> </ListView>
@code { [Inject] public CountryData CountryData { get; set; } public IEnumerable<Country> Countries; protected override async Task OnInitializedAsync() { Countries = await CountryData.GetDataAsync(); await base.OnInitializedAsync(); } }
Selectable items
Set theListView
Mode
to ListGroupMode.Selectable
.
Bind SelectedItem
and provide TextField
to setup the display text and ValueField
to uniquely identify the current active selection.
- Antarctica
- United Arab Emirates
- Afghanistan
- Albania
- Armenia
- Curacao
- Sint Maarten
- Netherlands Antilles
- Angola
- Argentina
- Australia
- Cocos Islands
- Christmas Island
- Heard Island and McDonald Islands
- Kiribati
- Norfolk Island
- Nauru
- Tuvalu
- Aruba
- Azerbaijan
- Bosnia and Herzegovina
- Barbados
- Bangladesh
- Bulgaria
- Bahrain
- Burundi
- Bermuda
- Brunei
- Bolivia
- Brazil
- Bahamas
- Bhutan
- Botswana
- Belarus
- Belize
- Canada
- Democratic Republic of the Congo
- Switzerland
- Liechtenstein
- Chile
- China
- Colombia
- Costa Rica
- Cuba
- Cape Verde
- Czech Republic
- Djibouti
- Denmark
- Faroe Islands
- Greenland
- Dominican Republic
- Algeria
- Egypt
- Eritrea
- Ethiopia
- Andorra
- Austria
- Aland Islands
- Belgium
- Saint Barthelemy
- Cyprus
- Germany
- Estonia
- Spain
- Finland
- France
- French Guiana
- Guadeloupe
- Greece
- Ireland
- Italy
- Kosovo
- Luxembourg
- Monaco
- Montenegro
- Saint Martin
- Martinique
- Malta
- Netherlands
- Saint Pierre and Miquelon
- Portugal
- Reunion
- Slovenia
- Slovakia
- San Marino
- French Southern Territories
- Vatican
- Mayotte
- Fiji
- Falkland Islands
- United Kingdom
- Guernsey
- South Georgia and the South Sandwich Islands
- Isle of Man
- Jersey
- Georgia
- Ghana
- Gibraltar
- Gambia
- Guinea
- Guatemala
- Guyana
- Hong Kong
- Honduras
- Croatia
- Haiti
- Hungary
- Indonesia
- Israel
- Palestinian Territory
- India
- Iraq
- Iran
- Iceland
- Jamaica
- Jordan
- Japan
- Kenya
- Kyrgyzstan
- Cambodia
- Comoros
- North Korea
- South Korea
- Kuwait
- Cayman Islands
- Kazakhstan
- Laos
- Lebanon
- Sri Lanka
- Liberia
- Lesotho
- Lithuania
- Latvia
- Libya
- Western Sahara
- Morocco
- Moldova
- Madagascar
- Macedonia
- Myanmar
- Mongolia
- Macao
- Mauritania
- Mauritius
- Maldives
- Malawi
- Mexico
- Malaysia
- Mozambique
- Namibia
- Nigeria
- Nicaragua
- Bouvet Island
- Norway
- Svalbard and Jan Mayen
- Nepal
- Cook Islands
- Niue
- New Zealand
- Pitcairn
- Tokelau
- Oman
- Panama
- Peru
- Papua New Guinea
- Philippines
- Pakistan
- Poland
- Paraguay
- Qatar
- Romania
- Serbia
- Serbia and Montenegro
- Russia
- Rwanda
- Saudi Arabia
- Solomon Islands
- Seychelles
- Sudan
- Sweden
- Singapore
- Saint Helena
- Sierra Leone
- Somalia
- Suriname
- South Sudan
- Sao Tome and Principe
- Syria
- Swaziland
- Thailand
- Tajikistan
- Turkmenistan
- Tunisia
- Tonga
- Turkey
- Trinidad and Tobago
- Taiwan
- Tanzania
- Ukraine
- Uganda
- American Samoa
- Bonaire, Saint Eustatius and Saba
- Ecuador
- Micronesia
- Guam
- British Indian Ocean Territory
- Marshall Islands
- Northern Mariana Islands
- Puerto Rico
- Palau
- El Salvador
- Turks and Caicos Islands
- East Timor
- United States Minor Outlying Islands
- United States
- British Virgin Islands
- U.S. Virgin Islands
- Uruguay
- Uzbekistan
- Venezuela
- Vietnam
- Vanuatu
- Samoa
- Central African Republic
- Republic of the Congo
- Cameroon
- Gabon
- Equatorial Guinea
- Chad
- Antigua and Barbuda
- Anguilla
- Dominica
- Grenada
- Saint Kitts and Nevis
- Saint Lucia
- Montserrat
- Saint Vincent and the Grenadines
- Burkina Faso
- Benin
- Ivory Coast
- Guinea-Bissau
- Mali
- Niger
- Senegal
- Togo
- New Caledonia
- French Polynesia
- Wallis and Futuna
- Yemen
- South Africa
- Zambia
- Zimbabwe
<ListView TItem="Country" Data="Countries" TextField="(item) => item.Name" ValueField="(item) => item.Iso" Mode="ListGroupMode.Selectable" MaxHeight="300px" @bind-SelectedItem=""> </ListView> <Field Horizontal> <FieldBody ColumnSize="ColumnSize.Is12"> Selected Item: @selectedListViewItem?.Name </FieldBody> </Field>
@code { [Inject] public CountryData CountryData { get; set; } public IEnumerable<Country> Countries; private Country selectedListViewItem; protected override async Task OnInitializedAsync() { Countries = await CountryData.GetDataAsync(); await base.OnInitializedAsync(); } }
Extending with custom item content
Customize the way you display theListView
items by providing ItemTemplate
.
AQ
Antarctica
AE
Abu DhabiUnited Arab Emirates
AF
KabulAfghanistan
AL
TiranaAlbania
AM
YerevanArmenia
CW
WillemstadCuracao
SX
PhilipsburgSint Maarten
AN
WillemstadNetherlands Antilles
AO
LuandaAngola
AR
Buenos AiresArgentina
AU
CanberraAustralia
CC
West IslandCocos Islands
CX
Flying Fish CoveChristmas Island
HM
Heard Island and McDonald Islands
KI
TarawaKiribati
NF
KingstonNorfolk Island
NR
YarenNauru
TV
FunafutiTuvalu
AW
OranjestadAruba
AZ
BakuAzerbaijan
BA
SarajevoBosnia and Herzegovina
BB
BridgetownBarbados
BD
DhakaBangladesh
BG
SofiaBulgaria
BH
ManamaBahrain
BI
BujumburaBurundi
BM
HamiltonBermuda
BN
Bandar Seri BegawanBrunei
BO
SucreBolivia
BR
BrasiliaBrazil
BS
NassauBahamas
BT
ThimphuBhutan
BW
GaboroneBotswana
BY
MinskBelarus
BZ
BelmopanBelize
CA
OttawaCanada
CD
KinshasaDemocratic Republic of the Congo
CH
BerneSwitzerland
LI
VaduzLiechtenstein
CL
SantiagoChile
CN
BeijingChina
CO
BogotaColombia
CR
San JoseCosta Rica
CU
HavanaCuba
CV
PraiaCape Verde
CZ
PragueCzech Republic
DJ
DjiboutiDjibouti
DK
CopenhagenDenmark
FO
TorshavnFaroe Islands
GL
NuukGreenland
DO
Santo DomingoDominican Republic
DZ
AlgiersAlgeria
EG
CairoEgypt
ER
AsmaraEritrea
ET
Addis AbabaEthiopia
AD
Andorra la VellaAndorra
AT
ViennaAustria
AX
MariehamnAland Islands
BE
BrusselsBelgium
BL
GustaviaSaint Barthelemy
CY
NicosiaCyprus
DE
BerlinGermany
EE
TallinnEstonia
ES
MadridSpain
FI
HelsinkiFinland
FR
ParisFrance
GF
CayenneFrench Guiana
GP
Basse-TerreGuadeloupe
GR
AthensGreece
IE
DublinIreland
IT
RomeItaly
XK
PristinaKosovo
LU
LuxembourgLuxembourg
MC
MonacoMonaco
ME
PodgoricaMontenegro
MF
MarigotSaint Martin
MQ
Fort-de-FranceMartinique
MT
VallettaMalta
NL
AmsterdamNetherlands
PM
Saint-PierreSaint Pierre and Miquelon
PT
LisbonPortugal
RE
Saint-DenisReunion
SI
LjubljanaSlovenia
SK
BratislavaSlovakia
SM
San MarinoSan Marino
TF
Port-aux-FrancaisFrench Southern Territories
VA
Vatican CityVatican
YT
MamoudzouMayotte
FJ
SuvaFiji
FK
StanleyFalkland Islands
GB
LondonUnited Kingdom
GG
St Peter PortGuernsey
GS
GrytvikenSouth Georgia and the South Sandwich Islands
IM
Douglas, Isle of ManIsle of Man
JE
Saint HelierJersey
GE
TbilisiGeorgia
GH
AccraGhana
GI
GibraltarGibraltar
GM
BanjulGambia
GN
ConakryGuinea
GT
Guatemala CityGuatemala
GY
GeorgetownGuyana
HK
Hong KongHong Kong
HN
TegucigalpaHonduras
HR
ZagrebCroatia
HT
Port-au-PrinceHaiti
HU
BudapestHungary
ID
JakartaIndonesia
IL
JerusalemIsrael
PS
East JerusalemPalestinian Territory
IN
New DelhiIndia
IQ
BaghdadIraq
IR
TehranIran
IS
ReykjavikIceland
JM
KingstonJamaica
JO
AmmanJordan
JP
TokyoJapan
KE
NairobiKenya
KG
BishkekKyrgyzstan
KH
Phnom PenhCambodia
KM
MoroniComoros
KP
PyongyangNorth Korea
KR
SeoulSouth Korea
KW
Kuwait CityKuwait
KY
George TownCayman Islands
KZ
AstanaKazakhstan
LA
VientianeLaos
LB
BeirutLebanon
LK
ColomboSri Lanka
LR
MonroviaLiberia
LS
MaseruLesotho
LT
VilniusLithuania
LV
RigaLatvia
LY
TripolisLibya
EH
El-AaiunWestern Sahara
MA
RabatMorocco
MD
ChisinauMoldova
MG
AntananarivoMadagascar
MK
SkopjeMacedonia
MM
Nay Pyi TawMyanmar
MN
Ulan BatorMongolia
MO
MacaoMacao
MR
NouakchottMauritania
MU
Port LouisMauritius
MV
MaleMaldives
MW
LilongweMalawi
MX
Mexico CityMexico
MY
Kuala LumpurMalaysia
MZ
MaputoMozambique
NA
WindhoekNamibia
NG
AbujaNigeria
NI
ManaguaNicaragua
BV
Bouvet Island
NO
OsloNorway
SJ
LongyearbyenSvalbard and Jan Mayen
NP
KathmanduNepal
CK
AvaruaCook Islands
NU
AlofiNiue
NZ
WellingtonNew Zealand
PN
AdamstownPitcairn
TK
Tokelau
OM
MuscatOman
PA
Panama CityPanama
PE
LimaPeru
PG
Port MoresbyPapua New Guinea
PH
ManilaPhilippines
PK
IslamabadPakistan
PL
WarsawPoland
PY
AsuncionParaguay
QA
DohaQatar
RO
BucharestRomania
RS
BelgradeSerbia
CS
BelgradeSerbia and Montenegro
RU
MoscowRussia
RW
KigaliRwanda
SA
RiyadhSaudi Arabia
SB
HoniaraSolomon Islands
SC
VictoriaSeychelles
SD
KhartoumSudan
SE
StockholmSweden
SG
SingapurSingapore
SH
JamestownSaint Helena
SL
FreetownSierra Leone
SO
MogadishuSomalia
SR
ParamariboSuriname
SS
JubaSouth Sudan
ST
Sao TomeSao Tome and Principe
SY
DamascusSyria
SZ
MbabaneSwaziland
TH
BangkokThailand
TJ
DushanbeTajikistan
TM
AshgabatTurkmenistan
TN
TunisTunisia
TO
Nuku'alofaTonga
TR
AnkaraTurkey
TT
Port of SpainTrinidad and Tobago
TW
TaipeiTaiwan
TZ
DodomaTanzania
UA
KievUkraine
UG
KampalaUganda
AS
Pago PagoAmerican Samoa
BQ
Bonaire, Saint Eustatius and Saba
EC
QuitoEcuador
FM
PalikirMicronesia
GU
HagatnaGuam
IO
Diego GarciaBritish Indian Ocean Territory
MH
MajuroMarshall Islands
MP
SaipanNorthern Mariana Islands
PR
San JuanPuerto Rico
PW
MelekeokPalau
SV
San SalvadorEl Salvador
TC
Cockburn TownTurks and Caicos Islands
TL
DiliEast Timor
UM
United States Minor Outlying Islands
US
WashingtonUnited States
VG
Road TownBritish Virgin Islands
VI
Charlotte AmalieU.S. Virgin Islands
UY
MontevideoUruguay
UZ
TashkentUzbekistan
VE
CaracasVenezuela
VN
HanoiVietnam
VU
Port VilaVanuatu
WS
ApiaSamoa
CF
BanguiCentral African Republic
CG
BrazzavilleRepublic of the Congo
CM
YaoundeCameroon
GA
LibrevilleGabon
GQ
MalaboEquatorial Guinea
TD
N'DjamenaChad
AG
St. John'sAntigua and Barbuda
AI
The ValleyAnguilla
DM
RoseauDominica
GD
St. George'sGrenada
KN
BasseterreSaint Kitts and Nevis
LC
CastriesSaint Lucia
MS
PlymouthMontserrat
VC
KingstownSaint Vincent and the Grenadines
BF
OuagadougouBurkina Faso
BJ
Porto-NovoBenin
CI
YamoussoukroIvory Coast
GW
BissauGuinea-Bissau
ML
BamakoMali
NE
NiameyNiger
SN
DakarSenegal
TG
LomeTogo
NC
NoumeaNew Caledonia
PF
PapeeteFrench Polynesia
WF
Mata UtuWallis and Futuna
YE
SanaaYemen
ZA
PretoriaSouth Africa
ZM
LusakaZambia
ZW
HarareZimbabwe
<ListView TItem="Country" Data="Countries" TextField="(item) => item.Name" ValueField="(item) => item.Iso" Mode="ListGroupMode.Static" MaxHeight="300px"> <ItemTemplate> <Div Flex="Flex.InlineFlex.JustifyContent.Between" Width="Width.Is100"> <Heading Margin="Margin.Is2.FromBottom">@context.Item.Iso</Heading> <Small>@context.Item.Capital</Small> </Div> <Paragraph Margin="Margin.Is2.FromBottom">@context.Text</Paragraph> </ItemTemplate> </ListView>
@code { [Inject] public CountryData CountryData { get; set; } public IEnumerable<Country> Countries; protected override async Task OnInitializedAsync() { Countries = await CountryData.GetDataAsync(); await base.OnInitializedAsync(); } }
Styling Individual Items
Customize the look of each item by using the right callbacks.- Antarctica
- United Arab Emirates
- Afghanistan
- Albania
- Armenia
- Curacao
- Sint Maarten
- Netherlands Antilles
- Angola
- Argentina
- Australia
- Cocos Islands
- Christmas Island
- Heard Island and McDonald Islands
- Kiribati
- Norfolk Island
- Nauru
- Tuvalu
- Aruba
- Azerbaijan
- Bosnia and Herzegovina
- Barbados
- Bangladesh
- Bulgaria
- Bahrain
- Burundi
- Bermuda
- Brunei
- Bolivia
- Brazil
- Bahamas
- Bhutan
- Botswana
- Belarus
- Belize
- Canada
- Democratic Republic of the Congo
- Switzerland
- Liechtenstein
- Chile
- China
- Colombia
- Costa Rica
- Cuba
- Cape Verde
- Czech Republic
- Djibouti
- Denmark
- Faroe Islands
- Greenland
- Dominican Republic
- Algeria
- Egypt
- Eritrea
- Ethiopia
- Andorra
- Austria
- Aland Islands
- Belgium
- Saint Barthelemy
- Cyprus
- Germany
- Estonia
- Spain
- Finland
- France
- French Guiana
- Guadeloupe
- Greece
- Ireland
- Italy
- Kosovo
- Luxembourg
- Monaco
- Montenegro
- Saint Martin
- Martinique
- Malta
- Netherlands
- Saint Pierre and Miquelon
- Portugal
- Reunion
- Slovenia
- Slovakia
- San Marino
- French Southern Territories
- Vatican
- Mayotte
- Fiji
- Falkland Islands
- United Kingdom
- Guernsey
- South Georgia and the South Sandwich Islands
- Isle of Man
- Jersey
- Georgia
- Ghana
- Gibraltar
- Gambia
- Guinea
- Guatemala
- Guyana
- Hong Kong
- Honduras
- Croatia
- Haiti
- Hungary
- Indonesia
- Israel
- Palestinian Territory
- India
- Iraq
- Iran
- Iceland
- Jamaica
- Jordan
- Japan
- Kenya
- Kyrgyzstan
- Cambodia
- Comoros
- North Korea
- South Korea
- Kuwait
- Cayman Islands
- Kazakhstan
- Laos
- Lebanon
- Sri Lanka
- Liberia
- Lesotho
- Lithuania
- Latvia
- Libya
- Western Sahara
- Morocco
- Moldova
- Madagascar
- Macedonia
- Myanmar
- Mongolia
- Macao
- Mauritania
- Mauritius
- Maldives
- Malawi
- Mexico
- Malaysia
- Mozambique
- Namibia
- Nigeria
- Nicaragua
- Bouvet Island
- Norway
- Svalbard and Jan Mayen
- Nepal
- Cook Islands
- Niue
- New Zealand
- Pitcairn
- Tokelau
- Oman
- Panama
- Peru
- Papua New Guinea
- Philippines
- Pakistan
- Poland
- Paraguay
- Qatar
- Romania
- Serbia
- Serbia and Montenegro
- Russia
- Rwanda
- Saudi Arabia
- Solomon Islands
- Seychelles
- Sudan
- Sweden
- Singapore
- Saint Helena
- Sierra Leone
- Somalia
- Suriname
- South Sudan
- Sao Tome and Principe
- Syria
- Swaziland
- Thailand
- Tajikistan
- Turkmenistan
- Tunisia
- Tonga
- Turkey
- Trinidad and Tobago
- Taiwan
- Tanzania
- Ukraine
- Uganda
- American Samoa
- Bonaire, Saint Eustatius and Saba
- Ecuador
- Micronesia
- Guam
- British Indian Ocean Territory
- Marshall Islands
- Northern Mariana Islands
- Puerto Rico
- Palau
- El Salvador
- Turks and Caicos Islands
- East Timor
- United States Minor Outlying Islands
- United States
- British Virgin Islands
- U.S. Virgin Islands
- Uruguay
- Uzbekistan
- Venezuela
- Vietnam
- Vanuatu
- Samoa
- Central African Republic
- Republic of the Congo
- Cameroon
- Gabon
- Equatorial Guinea
- Chad
- Antigua and Barbuda
- Anguilla
- Dominica
- Grenada
- Saint Kitts and Nevis
- Saint Lucia
- Montserrat
- Saint Vincent and the Grenadines
- Burkina Faso
- Benin
- Ivory Coast
- Guinea-Bissau
- Mali
- Niger
- Senegal
- Togo
- New Caledonia
- French Polynesia
- Wallis and Futuna
- Yemen
- South Africa
- Zambia
- Zimbabwe
@using System.Linq <ListView TItem="Country" Data="Countries" TextField="(item) => item.Name" ValueField="(item) => item.Iso" Mode="ListGroupMode.Selectable" MaxHeight="300px" ItemTextColor="((item) => Countries.IndexOf( item ) % 2 == 0 ? TextColor.Danger : TextColor.Success)" ItemBackground="(item) => Background.Default" ItemPadding="(item) => Padding.Is4" ItemClass="@((item) => $"country-{item.Iso}")" ItemStyle="@((item) => "border: 1px solid red")" @bind-SelectedItem=""> </ListView> <Field Horizontal> <FieldBody ColumnSize="ColumnSize.Is12"> Selected Item: @selectedListViewItem?.Name </FieldBody> </Field>
@code { [Inject] public CountryData CountryData { get; set; } public List<Country> Countries; private Country selectedListViewItem; protected override async Task OnInitializedAsync() { Countries = (await CountryData.GetDataAsync()).ToList(); await base.OnInitializedAsync(); } }
API
Attributes
ListView
Name | Description | Type | Default |
---|---|---|---|
Data |
Gets or sets the items data-source. | IEnumerable<TItem> |
|
SelectedItem |
Gets or sets currently selected item. | TItem |
|
SelectedItemChanged |
Occurs after the selected item has changed. | EventCallback<TItem> |
|
TextField |
Method used to get the display field from the supplied data source. | Func<TItem, string> |
|
ValueField |
Method used to get the value field from the supplied data source. | Func<TItem, string> |
|
Class |
Custom css class-names. | string |
|
Style |
Custom styles. | string |
|
Height |
Sets the ListView Height. | string |
|
MaxHeight |
Sets the ListView MaxHeight. | string |
250px |
Flush |
Remove some borders and rounded corners to render list group items edge-to-edge in a parent container (e.g., cards). | bool |
false |
Scrollable |
Makes the list group scrollable by adding a vertical scrollbar. | bool |
true |
Mode |
Defines the list-group behavior mode. | ListGroupMode |
Static |
Attributes |
Captures all the custom attribute that are not part of Blazorise component. | Dictionary<string, object> |
|
ChildContent |
Specifies the content to be rendered inside the ListView. | RenderFragment |
|
ItemTemplate |
Specifies the content to be rendered inside each item of the ListView. | RenderFragment<ItemContext<TItem>> |
|
Virtualize |
Gets or sets whether the listview will use the Virtualize functionality.
|
bool |
false |
SelectionMode |
Defines the list-group selection mode. | ListGroupSelectionMode |
ListGroupSelectionMode.Single |
SelectedItems |
Gets or sets currently selected items names. | List<string> |
|
SelectedItemsChanged |
An event raised when SelectedItems are changed. | EventCallback<List<string>> |
|
DisabledItem |
Method used to get the disabled items from the supplied data source. | Func<TItem, bool> |
|
ItemTextColor |
Method used to get the text color for the item. | Func<TItem, TextColor> |
|
ItemBackground |
Method used to get the background color for the item. | Func<TItem, Background> |
|
ItemPadding |
Method used to get the padding for the item. | Func<TItem, IFluentSpacing> |
|
ItemMargin |
Method used to get the margin for the item. | Func<TItem, IFluentSpacing> |
|
ItemClass |
Method used to get the class for the item. | Func<TItem, string> |
|
ItemStyle |
Method used to get the style for the item. | Func<TItem, string> |