Windows phone 7 动态数据模板宽度

Windows phone 7 动态数据模板宽度,windows-phone-7,Windows Phone 7,我想设计我的应用程序有动态宽度,这是自定义的尺寸的手机。下面的代码是我使用的列表框的数据模板: <DataTemplate x:Key="FlightsTemplate"> <StackPanel Orientation="Horizontal" Margin="3" Background="#FF171717" Height="35"> <TextBlock FontSize="19" Margin="1,0

我想设计我的应用程序有动态宽度,这是自定义的尺寸的手机。下面的代码是我使用的列表框的数据模板:

<DataTemplate x:Key="FlightsTemplate">
            <StackPanel Orientation="Horizontal" Margin="3" Background="#FF171717" Height="35">
                <TextBlock FontSize="19" Margin="1,0,0,0" TextAlignment="Center" Width="60"  Text="{Binding text1}"/>
                <TextBlock FontSize="19" Margin="1,0,0,0" TextAlignment="Center" Width="80"  Text="{Binding text2}"/>
                <TextBlock FontSize="19" Margin="1,0,0,0" TextAlignment="Center" Width="150" Text="{Binding text3}"/>
                <TextBlock FontSize="19" Margin="1,0,0,0" TextAlignment="Center" Width="90"  Text="{Binding text4}"/>
                <TextBlock FontSize="19" Margin="1,0,0,0" TextAlignment="Center" Width="70"  Text="{Binding text5}"/>
            </StackPanel>
        </DataTemplate>  

提前感谢您,

您需要为列表框的
ItemContainerStyle设置
HorizontalContentAlignment

像这样:

<ListBox.ItemContainerStyle>
    <Style TargetType="ListBoxItem">
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    </Style>
</ListBox.ItemContainerStyle>


这可以对stackpanel、border执行吗。。。我添加到xaml文件中的任何项目??StackPanel和Border都默认为Stretch。只需要对列表框执行此操作。数据模板的内容是不相关的。我的问题比这更复杂,假设我有一些垂直或水平方向的堆栈。那么,如何根据手机或stackpanel的分辨率来确定这些组件的高度或宽度呢
<ListBox.ItemContainerStyle>
    <Style TargetType="ListBoxItem">
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    </Style>
</ListBox.ItemContainerStyle>