2012-03-01 16 views
3

このエキスパンダーは垂直です。 Hightlight垂直エパーダーは垂直ヘッダーになります

としてヘッダーが表示され、私は

H 
i 
g 
h 
l 
i 
g 
h 
t 

それはそれをどのように得るかをしたいですか?あなたは、私はそれを受け入れる答えとしてとしてそれを投稿したい場合は

<Expander Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" 
    VerticalAlignment="Stretch" Header="Highlight" 
    ExpandDirection="Left" IsExpanded="False" Width="Auto"> 

、溶液を

<Expander Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Stretch" ExpandDirection="Left" IsExpanded="False" Width="Auto"> 
     <Expander.Header> 
       <TextBlock><ItemsControl ItemsSource="Highlight" /></TextBlock> 
     </Expander.Header> 

HBです。

+0

可能重複Wpf TextBlock](http://stackoverflow.com/questions/349875/vertical-text-in-wpf-textblock)| 'Expander.Header'は何でもかまいません([property element syntax](http://msdn.microsoft.com/en-us/library/ms788723.aspx#property_element_syntax)を使用してください)、これは縦書きのテキストになります。 –

答えて

4

どちらかHBのメモとして、プロパティ要素構文を使用するか、またはあなたが一般的にスタイルを適用したい場合は、あなたのパンダのためのDataTemplateのスタイルを定義し、そのような:で[縦テキストの

<Grid.Resources> 
    <DataTemplate x:Key="verticalHeader"> 
    <ItemsControl ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Expander}}, Path=Header}" /> 
    </DataTemplate> 

    <Style TargetType="{x:Type Expander}"> 
    <Setter Property="HeaderTemplate" Value="{StaticResource verticalHeader}"/> 
    </Style> 
</Grid.Resources>