Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6839263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:41:52+00:00 2026-05-26T23:41:52+00:00

Am Using the checkbox in listbox items, how to Checked and Unchecked all checkboxes

  • 0

Am Using the checkbox in listbox items, how to Checked and Unchecked all checkboxes from the listbox?

<ListBox Height="168" HorizontalAlignment="Left" Margin="45,90,0,0" Name="listBox1" VerticalAlignment="Top" Width="120">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <CheckBox Content="{Binding Name}" IsChecked="{Binding Ck, Mode=TwoWay}"/>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

DataBinding is :

        List<uu> xx = new List<uu>();
        xx.Add(new uu { Name = "A", Ck = false });
        xx.Add(new uu { Name = "A", Ck = false });
        listBox1.ItemsSource = xx;

Update :

Is it possible to do something like this:

 foreach (ListBoxItem item in listBox1.Items)
        {
            CheckBox ch = (CheckBox)item;
            ch.IsChecked = true;
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:41:53+00:00Added an answer on May 26, 2026 at 11:41 pm

    A couple of things to consider.

    1) First use an ObservableCollection (preferred) or a BindingList instead of a List as your datasource

    2) Make sure you implement INotifyPropertyChanged on your class. See an example here

    3) Now that you have your binding setup correctly, loop through the collection and set the checked property to false using a foreach or other loop. The binding system will handle the rest and the changes in your list will be properly reflected on the UI

    UPDATE: Added a brief code example

    In your code-behind:

        ObservableCollection<uu> list = new ObservableCollection<uu>();        
    
        MainWindow()
        {
            InitializeComponent();
    
            // Set the listbox's ItemsSource to your new ObservableCollection
            ListBox.ItemsSource = list;
        }
    
        public void SetAllFalse()
        {
            foreach (uu item in this.list)
            {
                item.Ck = false;
            }
        }
    

    Implementing INotifyPropertyChanged in uu class:

    public class uu: INotifyPropertyChanged
    {
        private bool _ck;
    
        public bool Ck
        {
            get { return _ck; }
            set
            {
                _ck = value;
                this.NotifyPropertyChanged("Ck");
            }
        }
    
        private void NotifyPropertyChanged(string name)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(name));
            }
        }
    
        #region INotifyPropertyChanged Members
    
        public event PropertyChangedEventHandler PropertyChanged;
    
        #endregion
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to select all items in a ListBox when a CheckBox is clicked.
I have made a CheckedListBox using the following: <ListBox x:Name=lst_checkBoxList ItemsSource={Binding}> <ListBox.ItemTemplate> <DataTemplate> <CheckBox
I am using Html.CheckBox() . The resulting HTML is: <input id=IsMultiGraph name=IsMultiGraph value=true type=checkbox>
Using VB6 Listbox checkbox EmpID Selected 001 unSelected 002 Selected 003 .... .... I
I'm using a Listbox with Checkboxes to select data in it. The source is
What are the pros and cons of using a Checkbox's Checked property vs the
While it is trivial to store a checkbox's checked state in a variable using
can anybody show me how to build a string using checkbox. what would be
I was wondering how can I validate a single checkbox using PHP and MySQL.
I'd like to do something like this to tick a checkbox using jQuery :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.