locked
Auto scale images in ListView with no behind code

    Question

  • Hello,

    I have a ListView that contains one or more images that are all the same size. The size of the image is unknown at design time and can change. But all images in the ListView will be the same size regardless. I would like to scale the images depending on the number of images in the ListView so that they are all visible. So, more images means the images are scaled smaller. Also, sometimes the images are taller then wide or wider then tall. 

    Is there any way to do this without latching onto the ListViews sizechange event or other behind code? Ideally, I'd like a solution 100% in XAML or with a generic Converter implementation.

    Thank you for any help.


    Tuesday, January 20, 2015 7:39 PM

Answers

  • <ViewBox>
       <ListView>

    Is this ?


    在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。

    • Marked as answer by jfradley Wednesday, January 28, 2015 11:07 PM
    Wednesday, January 21, 2015 3:50 PM

All replies

  • Hi JFradley,

    Your post is off-topic in the UI Design for Windows Store apps forum. I'll move it to a more appropriate forum, but since you don't provide enough information to know for sure which forum is most appropriate please let me know if I miss and I can redirect again.

    I don't think you'll be able to do this wholly in Xaml. My first thought would be to create a custom panel.

    In the future, please post questions about implementation in the appropriate Building Windows Store apps in... forum. The UI Design forum is about discussion what the app should look like, not how to implement that design.

    --Rob

    Wednesday, January 21, 2015 2:09 AM
    Moderator
  • <ViewBox>
       <ListView>

    Is this ?


    在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。

    • Marked as answer by jfradley Wednesday, January 28, 2015 11:07 PM
    Wednesday, January 21, 2015 3:50 PM