BulletedList.BulletStyle Właściwość
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Pobiera lub ustawia styl punktora dla kontrolki BulletedList .
public:
virtual property System::Web::UI::WebControls::BulletStyle BulletStyle { System::Web::UI::WebControls::BulletStyle get(); void set(System::Web::UI::WebControls::BulletStyle value); };
public virtual System.Web.UI.WebControls.BulletStyle BulletStyle { get; set; }
member this.BulletStyle : System.Web.UI.WebControls.BulletStyle with get, set
Public Overridable Property BulletStyle As BulletStyle
Wartość właściwości
BulletStyle Jedna z wartości. Wartość domyślna to NotSet.
Wyjątki
Określony typ nie jest jedną z BulletStyle wartości.
Przykłady
W poniższym przykładzie kodu pokazano, jak utworzyć kontrolkę BulletedList . Kontrolka ListBox jest wypełniana wszystkimi dostępnymi BulletStyle wartościami wyliczenia. Styl punktora zmienia się w zależności od stylu wybranego przez użytkownika w polu listy.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>
BulletStyle Example</title>
<script runat="server">
protected void Index_Changed(object sender, EventArgs e)
{
// Change the message displayed, based on
// the style selected from the list box.
if (BulletStylesListBox.SelectedIndex > -1)
{
Message.Text = "You selected bullet style: " +
BulletStylesListBox.SelectedItem.Text;
}
// Change the bullet style used, based on
// the style selected from the list box.
switch (BulletStylesListBox.SelectedIndex)
{
case 0:
ItemsBulletedList.BulletStyle = BulletStyle.Numbered;
break;
case 1:
ItemsBulletedList.BulletStyle = BulletStyle.LowerAlpha;
break;
case 2:
ItemsBulletedList.BulletStyle = BulletStyle.UpperAlpha;
break;
case 3:
ItemsBulletedList.BulletStyle = BulletStyle.LowerRoman;
break;
case 4:
ItemsBulletedList.BulletStyle = BulletStyle.UpperRoman;
break;
case 5:
ItemsBulletedList.BulletStyle = BulletStyle.Disc;
break;
case 6:
ItemsBulletedList.BulletStyle = BulletStyle.Circle;
break;
case 7:
ItemsBulletedList.BulletStyle = BulletStyle.Square;
break;
case 8:
ItemsBulletedList.BulletStyle = BulletStyle.CustomImage;
// Specify the path to the custom image to use for the bullet.
ItemsBulletedList.BulletImageUrl = "Images/image1.jpg";
break;
case 9:
Message.Text = "You selected NotSet. The browser will determine the bullet style.";
break;
default:
throw new Exception("You did not select a valid bullet style.");
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<h3>
BulletStyle Example</h3>
<asp:BulletedList ID="ItemsBulletedList" DisplayMode="Text" BulletStyle="NotSet"
runat="server">
<asp:ListItem Value="0">Coho Winery</asp:ListItem>
<asp:ListItem Value="1">Contoso, Ltd.</asp:ListItem>
<asp:ListItem Value="2">Tailspin Toys</asp:ListItem>
</asp:BulletedList>
<hr />
<h4>
Select a bullet type:</h4>
<asp:ListBox ID="BulletStylesListBox" SelectionMode="Single" Rows="1" OnSelectedIndexChanged="Index_Changed"
AutoPostBack="True" runat="server">
<asp:ListItem Value="Numbered">Numbered</asp:ListItem>
<asp:ListItem Value="LowerAlpha">LowerAlpha</asp:ListItem>
<asp:ListItem Value="UpperAlpha">UpperAlpha</asp:ListItem>
<asp:ListItem Value="LowerRoman">LowerRoman</asp:ListItem>
<asp:ListItem Value="UpperRoman">UpperRoman</asp:ListItem>
<asp:ListItem>Disc</asp:ListItem>
<asp:ListItem>Circle</asp:ListItem>
<asp:ListItem>Square</asp:ListItem>
<asp:ListItem>CustomImage</asp:ListItem>
<asp:ListItem Value="NotSet">NotSet</asp:ListItem>
</asp:ListBox>
<hr />
<asp:Label ID="Message" runat="server" AssociatedControlID="BulletStylesListBox" />
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>BulletStyle Example</title>
<script runat="server">
Sub Index_Changed(ByVal sender As Object, ByVal e As System.EventArgs)
' Change the message displayed, based on
' the style selected from the list box.
If BulletStylesListBox.SelectedIndex > -1 Then
Message.Text = "You selected bullet style: " & BulletStylesListBox.SelectedItem.Text
End If
' Change the bullet style used, based on
' the style selected from the list box.
Select Case (BulletStylesListBox.SelectedIndex)
Case 0
ItemsBulletedList.BulletStyle = BulletStyle.Numbered
Case 1
ItemsBulletedList.BulletStyle = BulletStyle.LowerAlpha
Case 2
ItemsBulletedList.BulletStyle = BulletStyle.UpperAlpha
Case 3
ItemsBulletedList.BulletStyle = BulletStyle.LowerRoman
Case 4
ItemsBulletedList.BulletStyle = BulletStyle.UpperRoman
Case 5
ItemsBulletedList.BulletStyle = BulletStyle.Disc
Case 6
ItemsBulletedList.BulletStyle = BulletStyle.Circle
Case 7
ItemsBulletedList.BulletStyle = BulletStyle.Square
Case 8
ItemsBulletedList.BulletStyle = BulletStyle.CustomImage
' Specify the path to the custom image to use for the bullet.
ItemsBulletedList.BulletImageUrl = "Images/image1.jpg"
Case 9
Message.Text = "You selected NotSet. The browser will determine the bullet style."
Case Else
Throw New Exception("You did not select a valid bullet style.")
End Select
End Sub
</script>
</head>
<body>
<form id="form1" runat="server">
<h3>BulletStyle Example</h3>
<asp:BulletedList id="ItemsBulletedList"
DisplayMode="Text"
BulletStyle="NotSet"
runat="server">
<asp:ListItem Value="0">Coho Winery</asp:ListItem>
<asp:ListItem Value="1">Contoso, Ltd.</asp:ListItem>
<asp:ListItem Value="2">Tailspin Toys</asp:ListItem>
</asp:BulletedList>
<hr />
<h4>Select a bullet type:</h4>
<asp:ListBox id="BulletStylesListBox"
SelectionMode="Single"
Rows="1"
OnSelectedIndexChanged="Index_Changed"
AutoPostBack="True"
runat="server">
<asp:ListItem Value="Numbered">Numbered</asp:ListItem>
<asp:ListItem Value="LowerAlpha">LowerAlpha</asp:ListItem>
<asp:ListItem Value="UpperAlpha">UpperAlpha</asp:ListItem>
<asp:ListItem Value="LowerRoman">LowerRoman</asp:ListItem>
<asp:ListItem Value="UpperRoman">UpperRoman</asp:ListItem>
<asp:ListItem>Disc</asp:ListItem>
<asp:ListItem>Circle</asp:ListItem>
<asp:ListItem>Square</asp:ListItem>
<asp:ListItem>CustomImage</asp:ListItem>
<asp:ListItem Value="NotSet">NotSet</asp:ListItem>
</asp:ListBox>
<hr />
<asp:Label id="Message"
runat="server"
AssociatedControlID="BulletStylesListBox"/>
</form>
</body>
</html>
Uwagi
BulletStyle Użyj właściwości , aby określić styl punktora, który ma być stosowany do elementów listy w kontrolceBulletedList. Właściwość BulletStyle jest ustawiana przy użyciu jednej z BulletStyle wartości wyliczenia. W poniższej tabeli wymieniono możliwe wartości.
Styl punktora | Opis |
---|---|
NotSet | Nie ustawiono. |
Numbered | Liczba. |
LowerAlpha | Mała litera. |
UpperAlpha | Wielka litera. |
LowerRoman | Małe litery — cyfra rzymska. |
UpperRoman | Wielka litera cyfry rzymskiej. |
Disc | Wypełniony okrąg. |
Circle | Pusty okrąg. |
Square | Wypełniony kwadrat. |
CustomImage | Obraz niestandardowy. |
Określenie CustomImage wartości umożliwia podanie własnego obrazu dla punktora. Jeśli określisz CustomImage wartość, musisz również ustawić BulletImageUrl właściwość na adres URL obrazu niestandardowego do użycia.
Uwaga
Kontrolka BulletedList nie obsługuje AlternateText właściwości, ponieważ kule są z natury dekoracyjne i nie dostarczają dodatkowych informacji, które należy przekazać za pośrednictwem technologii pomocniczej. Jeśli jednak chcesz użyć obrazu niestandardowego do przekazania koncepcji użytkownikowi, należy dodać dodatkowy tekst do każdego z elementów listy punktowanej lub użyć kontrolki, która umożliwia określenie alternatywnego tekstu dla każdego obrazu.
Wartość tej właściwości jest przechowywana w stanie widoku.