列表框内的复选框
答
<asp:CheckBoxList id="checkboxlist1" runat="server">
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
</asp:CheckBoxList>
要访问用户的行动项目
void checkboxlist1_Clicked(Object sender, EventArgs e)
{
if (checkBoxList1.SelectedIndex == 1)
{
// DoSomething
}
}
+0
这是CheckBoxList,而不是checkedListBox。 – 2010-02-06 08:12:36
答
<ListBox x:Name="targetList" ItemsSource="{Binding}">
<ListBox.ItemTemplate>
<HierarchicalDataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox>
<TextBlock Text="{Binding Path=Name}"/>
</CheckBox>
</StackPanel>
</HierarchicalDataTemplate>
</ListBox.ItemTemplate>
</ListBox>
+0
原始海报(OP)询问ASP.NET解决方案 - 请阅读该问题。 – 2010-02-06 07:30:21
分步链接已损坏。 – 2017-01-06 10:19:38