2012-03-01 5 views
3

이 확장기는 세로입니다. Hightlight세로 Epander 세로 헤더처럼됩니다

같은 헤더가 표시 나는

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> 
[수직 텍스트에서의