简体   繁体   中英

LongListMultiSelector doesn't get width of parent item on WP8

There is WP8 app. I have LongListMultiSelector (without any options) that's inside PanoramItem. But actual width of LongListMultiSelector is more than parent PanoramaItem (on my device: 432 vs 444). I tried to set HorizontalAlignemt option to "Stretch" but it didn't help me. What's problem?

That's really the problem of using list controls in WP. Try setting the Width explicitly, or in the DataTemplate 's panel (say you use Grid as your template root panel)

<LongListMultiSelector.ItemTemplate>
    <DataTemplate>
        <Grid Width="440">
        </Grid>
    </DataTemplate>
</LongListMultiSelector.ItemTemplate>

It's happening because of ScrollViewer of LongListSelector. And because of ScrollViewer phone calculates wrong width of items inside control. I found only one solution — set another margin option of SV and content area in LongListSelector Style. But it's not ideal because in this case ScrollViewer is outside the width you need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM