Tarida George
Tarida George

Reputation: 1303

Unchecking event ListView Windows Form Application

How can I trigger unchecking box action in a ListView control ? In default ListView events I can only see ItemCheck and ItemChecked event where is ItemUnchecked and ItemUncheck?

Upvotes: 1

Views: 530

Answers (1)

keyboardP
keyboardP

Reputation: 69372

Handle the ItemCheck event and read the NewValue property to determine if it's about to be checked or unchecked.

private void myListView_ItemCheck(object sender, ItemCheckEventArgs e)
{
    if (e.NewValue == CheckState.Unchecked)
    { 
        //unchecked
    }       
    else if(e.NewValue == CheckState.Checked)
    {
        //checked
    }               
}

Upvotes: 3

Related Questions