CheckBox inside ListBox

后端 未结 3 1443
有刺的猬
有刺的猬 2020-12-12 03:44

How to add checkbox inside the listbox. Where ChechBoxList controls is not good for more records, By using listbox user can easily scroll to choose the item.

Geetha.

相关标签:
3条回答
  • 2020-12-12 03:54

    What you want is the

    CheckBoxList.

    Newer CheckBoxList

    Pretty nice step-by-step here.

    0 讨论(0)
  • 2020-12-12 03:58

    what about checkedListBox ?

    <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>
    

    To access items on user action

    void checkboxlist1_Clicked(Object sender, EventArgs e) 
    {          
       if (checkBoxList1.SelectedIndex == 1)
       {
           // DoSomething  
       }      
    }
    
    0 讨论(0)
  • 2020-12-12 03:59
    <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 讨论(0)
提交回复
热议问题