none
Change background color of multi-selected items in HTML Client

    Question

  • Hi, 

    I would change color of multi items when I click/tap them on a list directly, not by checkbox. When I click them again, they could return to un-selected state and change color as old. This is my design screen:

     

    "Items Name" has type "text" in a list. I chose a method "ItemsName_Tap_execute" to set multi select background color changing, but not work. Currently:

    When tap "ho", its color background could change as "sot". Them, when tap them again, their background is return as "so mui" background. How could I do it?

    Thanks a lot,

    An.



    • Edited by Little_1991 Saturday, November 09, 2013 9:45 AM
    Saturday, November 09, 2013 9:35 AM

Answers

  • Hi,

    If you want to change the background color and font color for list items. This procedure will be good guide for you.

    The appearance of a ListView control is determined by a cascading style sheet (CSS), and the style is quite complex. Rather than trying to edit the CSS, you can use the postRender method to change the colors in code. Note that you can’t change the style of the ListView itself, but you can change the style of each List Item through its parent, the RowTemplate. Each List Item has a background-image defined, so you’ll need to specify a  background-image before applying a new background-color.

    To change the colors

    1. In the screen designer, choose the Rows Layout (or Columns Layout) node for a list.

    2. In the Properties window, choose the Edit PostRender Code link.

    3. In the Code Editor, add the following code to the postRender method:

    contentItem.dataBind("value", function (value) {
            if (value) {
                $(element).text(value.toFixed(2));
            }
        });
    

    hope it helps,

    Regards

    Angie


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Wednesday, November 20, 2013 6:55 AM
    Moderator