Click here to Skip to main content
15,913,610 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
I have a listview with view as details and i have set checkbox option to true, i have set full row select to true. now when i check the checkbox, corresponding row backcolor should change to blue(entire row)..how to do this??


thanks in advance,
Posted

this will do the work..i posted it here bcos it may help some one

thanks,

C#
void ListView1_ItemCheck(object sender, ItemCheckEventArgs e)
{
    try
    {
        listView1.FullRowSelect=true;
        if(listView1.Items[e.Index].Checked==false)
        {
            listView1.Items[e.Index].BackColor=Color.Aqua;
        }
        else
        {
            listView1.Items[e.Index].BackColor=Color.White;
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}
 
Share this answer
 
v3
If you're in WPF you are probably binding to a list of items. Add a property to the model-view object that represents rows for background colour, calculate a colour based on the property that is represented as the checked state, and bind that new property to the background colour in the item template.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900