2016-08-31 1 views
0

ListView 안에 내용 목록이 있습니다. 각 항목에는 ID가 들어 있으며이 ID는 Flyout 내부에서 클릭 한 행의 세부 정보를 표시하는 이벤트로 전달됩니다. 지금이 상황했습니다 : 당신은 내가 rowFlyoutRow라고 정의한 주요 그리드에서 볼 수있는 방법을 너무플라이 아웃을 연속으로 표시 하시겠습니까?

<Grid> 
    <Grid.ColumnDefinitions> 
     <ColumnDefinition Width="*"/> 
    </Grid.ColumnDefinitions> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="Auto"/> 
     <RowDefinition Height="5" x:Name="FlyoutRow"/> 
    </Grid.RowDefinitions> 

을,이 행은 시작시 표시되지 않지만의 경우에만 이벤트의 사용자 클릭이 있음 ListView.

문제가 행 높이가 5이므로 Flyout이 사용자에게 표시되지 않으며 Flyout 애니메이션을 유지하는 행을 확장 할 수 있습니까? 자동으로

<Controls:Flyout x:Name="Flyout" Header="Flyout" Grid.Row="1"> 

</Controls:Flyout> 

답변

0

설정 행 높이 :

이는 Flyout 내 구현입니다. 그런 다음 플라이 아웃 높이를 조정할 스토리 보드를 사용하십시오. 내가 5px 공간이 필요합니다 원인

<Window x:Class="WpfApplication1.MainWindow" 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
     xmlns:local="clr-namespace:WpfApplication1" 
     xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" 
     mc:Ignorable="d" 
     Title="MainWindow" Height="350" Width="525"> 

    <Window.Resources> 
     <Storyboard x:Key="Maximize"> 
      <DoubleAnimation Duration="0:0:0.5" Storyboard.TargetProperty="Height" From="5" To="100" Storyboard.TargetName="FL"> 
      </DoubleAnimation> 
     </Storyboard> 

     <Storyboard x:Key="Minimize"> 
      <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetProperty="Height" From="100" To="5" Storyboard.TargetName="FL"> 
      </DoubleAnimation> 
     </Storyboard> 
    </Window.Resources> 
    <Grid> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="292*"/> 
      <RowDefinition Height="Auto" x:Name="FlyoutRow"/> 
     </Grid.RowDefinitions> 
     <ListView x:Name="View"> 
      <ListView.Triggers> 
       <EventTrigger RoutedEvent="ListView.SelectionChanged"> 
        <BeginStoryboard Storyboard="{StaticResource Maximize}"/> 
       </EventTrigger> 
       <EventTrigger RoutedEvent="ListView.LostFocus"> 
        <BeginStoryboard Storyboard="{StaticResource Minimize}"/> 
       </EventTrigger> 
      </ListView.Triggers> 
      <ListBoxItem Content="First item" Tag="Some information from first item"/> 
      <ListBoxItem Content="Second item" Tag="Some information from second item"/> 
      <ListBoxItem Content="Third item" Tag="Some information from third item"/> 
      <ListBoxItem Content="Fourth item" Tag="Some information from fourth item"/> 
      <ListBoxItem Content="Fifth item" Tag="Some information from fifth item"/> 
      <ListBoxItem Content="Sixth item" Tag="Some information from sixth item"/> 
      <ListBoxItem Content="Seventh item" Tag="Some information from Seventh item"/> 
      <ListBoxItem Content="Eigth item" Tag="Some information from eith item"/> 
     </ListView> 
     <controls:Flyout Grid.Row="1" Width="517" x:Name="FL" HorizontalContentAlignment="Stretch" IsOpen="True"> 
      <TextBlock Text="{Binding ElementName=View, Path=SelectedItem.Tag}" Background="#FF74FF24"/> 
     </controls:Flyout> 
    </Grid> 
</Window> 
+0

이 내가 자동으로 설정하면이 공간이 5px 높이와 한 번 더 행을 추가 – AgainMe

+0

을 잃게됩니다, '문제가 해결되지 않습니다. –

+0

다른 행을 추가하면 행 사이에 더 많은 공간이 생깁니다. – AgainMe

관련 문제