0
[x] ID Name 
[x] 1  abc
[x] 2  def
[x] 3  xyz
selectAll  ClearAll

The above show a listview with columns of checkbox and with ID and Name columns. [x] is checkbox..i am doing this in WPF.

i want when i click on select all button everyrow of checkbox is selected and when clear all it will clear all checkboxes to false.. Please is there any complete tutorial or example solve plese share..

3
  • 1
    So, is this about a DataGrid or a Listview? Commented Jul 3, 2013 at 12:40
  • I am using Listview and i want with listview Commented Jul 3, 2013 at 12:41
  • @PanagiotisKanavos i want this in WPF Commented Jul 3, 2013 at 13:08

1 Answer 1

1

In the button handlers for your buttons you need the following code:

foreach (var item in dataSource)
{
    item.Checked = true;  // or false for ClearAll
}

You change the values in the source data and the UI will update to reflect that change.

If you haven't already, you need to set up a handler for the button click - this can be either a command or a click handler. Which one will depend on how you have structured your application.

The code goes inside those handlers.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.