locked
horizontal alignment of ListView content

    Question

  • Hi All

    Is it possible to align the content of a listview central or right? At the moment all itemtemplates align to the left of the listView so say you have a 1000px wide listview and 3 templates of 100px wide they will all sit on the left side. Is there a way to make them sit in the middle or right?

    Thx


    Monday, December 10, 2012 3:03 PM

Answers

  • Hi,

    Please add the follow style:

    h1, h2, h3, h4, h5, h6 {
                float:right !important;
            }


    Roy
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Syllogism Thursday, December 13, 2012 8:01 AM
    Wednesday, December 12, 2012 3:25 AM
  • It should indeed be possible to align the content to the center or the right.

    Song has a couple of good starts on how to achieve this but honestly the best way is to just go to the top of your project, open the References section, expand CSS, and open ui-light.css or ui-dark.css and just search for win-listivew. This will give you a way to see what styles are being applied to the control by default.

    I was able to successfully right-align the text content in my ListView with this simple CSS rule that I used the above method to determine:

    .win-listview .win-container {
        text-align: right;
    }

    Hope it helps! Let us know if that doesn't work for you and we can try to find what will!


    • Edited by got.dibbs Wednesday, December 12, 2012 5:19 AM
    • Proposed as answer by got.dibbs Wednesday, December 12, 2012 3:13 PM
    • Marked as answer by Syllogism Thursday, December 13, 2012 8:01 AM
    Wednesday, December 12, 2012 5:18 AM

All replies

  • Hi,

    You could override some css style to align the content of a listview central or right.

    Just debug the app and change the corresponding style.

    #Quickstart: Debugging apps (JavaScript)

    http://msdn.microsoft.com/en-us/library/windows/apps/hh441474.aspx


    Roy
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, December 11, 2012 9:42 AM
  • thanks for that tip, I tried it but I don't see where one would change the CSS to modify the alignment.

    • Edited by Syllogism Tuesday, December 11, 2012 12:58 PM
    Tuesday, December 11, 2012 12:18 PM
  • Hi,

    Please add the follow style:

    h1, h2, h3, h4, h5, h6 {
                float:right !important;
            }


    Roy
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Syllogism Thursday, December 13, 2012 8:01 AM
    Wednesday, December 12, 2012 3:25 AM
  • It should indeed be possible to align the content to the center or the right.

    Song has a couple of good starts on how to achieve this but honestly the best way is to just go to the top of your project, open the References section, expand CSS, and open ui-light.css or ui-dark.css and just search for win-listivew. This will give you a way to see what styles are being applied to the control by default.

    I was able to successfully right-align the text content in my ListView with this simple CSS rule that I used the above method to determine:

    .win-listview .win-container {
        text-align: right;
    }

    Hope it helps! Let us know if that doesn't work for you and we can try to find what will!


    • Edited by got.dibbs Wednesday, December 12, 2012 5:19 AM
    • Proposed as answer by got.dibbs Wednesday, December 12, 2012 3:13 PM
    • Marked as answer by Syllogism Thursday, December 13, 2012 8:01 AM
    Wednesday, December 12, 2012 5:18 AM
  • thanks for the help everyone!
    Wednesday, December 12, 2012 8:38 AM