2014-09-11 8 views
0

아래의 코드는 작동중인 익스팬더의 아주 간단한 코드입니다. 현재 확장기는 텍스트 블록을 확장하고 그 아래의 라디오 버튼은 아래로 움직입니다. 라디오 버튼을 그대로두고 텍스트 블록을 표시하고 싶습니다. 또한 현재 위치에 확장기 아이콘을 유지하고 싶습니다. 감사!콘트롤 아래 콘텐트를 확장하십시오.

<Window x:Class="Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="Expender WPF Sample" Height="300" Width="400" 
    > 
<Grid> 
    <Grid.ColumnDefinitions> 
     <ColumnDefinition /> 
     <ColumnDefinition /> 
    </Grid.ColumnDefinitions> 

    <Grid Grid.Column="0"> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="Auto" /> 
      <RowDefinition /> 
     </Grid.RowDefinitions> 
      <StackPanel Grid.Row="1" Margin="10,5,0,0"> 
       <RadioButton Content="Choice One"/> 
       <RadioButton Content="Choice Two"/> 
       <RadioButton Content="Choice Three"/> 
      </StackPanel> 
      <Expander HorizontalAlignment="Right" Header="" 
        VerticalAlignment="Top" ExpandDirection="Down" Width="150"> 
      <TextBlock TextWrapping="Wrap" Background="AntiqueWhite"> 
       This is the standard expander 
       behavior. The expander opens 
       and the controls below it 
       move down. 
      </TextBlock> 
     </Expander> 

    </Grid> 


</Grid> 
</Window> 

답변

1
<Grid> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition /> 
      <ColumnDefinition /> 
     </Grid.ColumnDefinitions> 

     <Grid Grid.Column="0"> 
      <Grid.RowDefinitions> 
       <RowDefinition Height="Auto" /> 
       <RowDefinition /> 
      </Grid.RowDefinitions> 

      <Expander HorizontalAlignment="Right" 
        VerticalAlignment="Top" ExpandDirection="Down" Width="150"> 
       <Expander.Header> 
        <StackPanel Grid.Row="1" Margin="10,5,0,0"> 
         <RadioButton Content="Choice One"/> 
         <RadioButton Content="Choice Two"/> 
         <RadioButton Content="Choice Three"/> 
        </StackPanel> 
       </Expander.Header> 
       <TextBlock TextWrapping="Wrap" Background="AntiqueWhite"> 
       This is the standard expander 
       behavior. The expander opens 
       and the controls below it 
       move down. 
       </TextBlock> 
      </Expander> 

     </Grid> 
    </Grid> 
+0

내가 헤더로 데이터를 넣어 시도했습니다. 그러나 확장자의 표시 여부를 숨김으로 설정하여 확장 아이콘을 숨기려고합니다. 그러면 내가하고 싶지 않은 라디오 버튼도 숨길 것입니다. – user2402616

+1

그래서 Expander가 필요한 이유는 ... 아이콘이 없으면 사용자가이 기능을 어떻게 사용할 수 있습니까? –

+0

좀 더 자세히 설명하자면, 마우스가 창 밖에있을 때 아이콘을 숨기고 마우스가 창에 들어갈 때 아이콘이 보이기를 원합니다. 예를 들어 간단한 Google 뉴스 기사를보십시오. news.google.com – user2402616