ListBoxItem宽度不能自适应

There is a bug in the CTP version of ListBoxItem template that doesn't honour the "Stretch" property. What you want is add something like this to your ListBox to make the items stretch:

<ListBox.ItemContainerStyle>
 <Style TargetType="ListBoxItem">
  <Setter Property="Template">
   <Setter.Value>
    <ControlTemplate>
     <ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
    </ControlTemplate> 				
   </Setter.Value> 			
  </Setter>
 </Style>
</ListBox.ItemContainerStyle>

This is fixed in the latest internal builds.

posted on 2012-05-10 00:30  wchao911  阅读(196)  评论(0编辑  收藏  举报

导航