简体   繁体   English

LongListMultiSelector在WP8上未获取父项的宽度

[英]LongListMultiSelector doesn't get width of parent item on WP8

There is WP8 app. 有WP8应用程序。 I have LongListMultiSelector (without any options) that's inside PanoramItem. 我在PanoramItem内部有LongListMultiSelector(没有任何选项)。 But actual width of LongListMultiSelector is more than parent PanoramaItem (on my device: 432 vs 444). 但是LongListMultiSelector的实际宽度大于父级PanoramaItem(在我的设备上:432 vs 444)。 I tried to set HorizontalAlignemt option to "Stretch" but it didn't help me. 我试图将Horizo​​ntalAlignemt选项设置为“ Stretch”,但这对我没有帮助。 What's problem? 什么问题?

That's really the problem of using list controls in WP. 这确实是在WP中使用列表控件的问题。 Try setting the Width explicitly, or in the DataTemplate 's panel (say you use Grid as your template root panel) 尝试显式设置Width ,或在DataTemplate的面板中设置Width (例如,将Grid用作模板根面板)

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

It's happening because of ScrollViewer of LongListSelector. 这是由于LongListSelector的ScrollViewer引起的。 And because of ScrollViewer phone calculates wrong width of items inside control. 而且由于ScrollViewer,手机无法计算控件内部项目的宽度。 I found only one solution — set another margin option of SV and content area in LongListSelector Style. 我发现只有一个解决方案—在LongListSelector样式中设置SV和内容区域的另一个边距选项。 But it's not ideal because in this case ScrollViewer is outside the width you need. 但这不是理想的,因为在这种情况下ScrollViewer超出了您需要的宽度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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