WP8 Expanderview标题对齐

时间:2014-01-28 07:16:10

标签: xaml windows-phone-8

想要在expandderview右侧的标题中对齐文本。 这是我的代码:

<toolkit:ExpanderView HorizontalAlignment="Stretch">
    <toolkit:ExpanderView.Header>
         <TextBlock HorizontalAlignment="Right" Text="test"></TextBlock>
    </toolkit:ExpanderView.Header>
</toolkit:ExpanderView>

但它保持不变。为什么呢?

enter image description here

1 个答案:

答案 0 :(得分:0)

我认为你可以改变Header的宽度,并使用TextAlignment。就像这段代码一样。希望它对你有所帮助。

<toolkit:ExpanderView x:Name="ev" HorizontalAlignment="Stretch">
                <toolkit:ExpanderView.Header>
                        <TextBlock  Width="{Binding ActualWidth, ElementName=ev}"  HorizontalAlignment="Stretch" TextAlignment="Right" Text="test"></TextBlock>
                </toolkit:ExpanderView.Header>
            </toolkit:ExpanderView>