故事板目标不明确

时间:2016-04-07 13:47:30

标签: xaml storyboard fadein

为什么故事板在我TextBox x:Name="WelcomeText" RelativePanel x:Name="WelcomeRelativePanelUserControl"内逐渐消失。

在我的理解中,故事板目标是 FlipView x:Name="fvWelcome"

中的RelativePanel x:Name="fvWelcomeRelativePanel"
<RelativePanel x:Name="WelcomeRelativePanelUserControl" Background="#FF1F4E79" >
         <TextBox x:Name="WelcomeText"
                  RelativePanel.AlignLeftWithPanel="True"
                  Margin="145,0,0,0"
                  Foreground="White"
                  FontFamily="Segoe UI"
                  IsReadOnly="True"
                  BorderBrush="#FF1F4E79" 
                  BorderThickness="0" 
                  HorizontalAlignment="Center"
                  FontSize="84"
                  TextWrapping="Wrap" 
                  AcceptsReturn="True" 
                  Background="#FF1F4E79" 
                  Text="Welcome"/>
  </RelativePanel>  

另一个控件:

<RelativePanel x:Name="fvWelcomeRelativePanel">
    <FlipView x:Name="fvWelcome" 
              RelativePanel.AlignBottomWithPanel="True">
              <FlipView.Triggers>
                  <EventTrigger>
                        <BeginStoryboard>
                            <Storyboard x:Name="FlpVOpacity">
                                <DoubleAnimation
                                     Storyboard.TargetName="fvWelcome"
                                     Storyboard.TargetProperty="(FlipView.Opacity)"
                                     AutoReverse="True"
                                     From="0"
                                     To="1" 
                                     Duration="0:0:4" 
                                     RepeatBehavior="1x"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </FlipView.Triggers>
                <FlipView.ItemTemplate >
                    <DataTemplate>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition x:Name="Welcome" Height="0.3*"/>
                                <RowDefinition x:Name="GuestName" />
                            </Grid.RowDefinitions>
                        <TextBox x:Name="GuestNameTextBox"
                                 Grid.Row="1"
                                 IsReadOnly="True"
                                 Foreground="White"
                                 Margin="145,0,0,0"
                                 FontFamily="Segoe UI"
                                 BorderBrush="#FF1F4E79" 
                                 BorderThickness="0"
                                 Text="{Binding}" 
                                 FontSize="84"
                                 TextWrapping="Wrap"
                                 AcceptsReturn="True" 
                                 Background="#FF1F4E79">
                          </TextBox>
                        </Grid>
                    </DataTemplate>
                </FlipView.ItemTemplate>
       </FlipView>
</RelativePanel>

我的淡入淡出效果很好但为什么TextBox x:Name="WelcomeText"的文字也会消失?它不应该。我不明白为什么?我怎么能禁止这个效果在这个文本框上,并让它在第二个控件的TextBox x:Name="GuestNameTextBox"上运行fvWelcome

1 个答案:

答案 0 :(得分:0)

<RelativePanel x:Name="GeneralPanelGuest">

我解决了这个问题,只是将这个一般的relativePanel和另外2个RelativePanel放在我不想拥有相同行为的2个不同项目中,并删除了我曾经把欢迎放在fliepView里面的网格这是继承

  <RelativePanel x:Name="WelcomeRelativePanelUserControl" Background="#FF1F4E79" >


                    <TextBox x:Name="WelcomeText"
                                     RelativePanel.AlignLeftWithPanel="True"

                                     Margin="145,0,0,0"
                                     Foreground="White"
                                     FontFamily="Segoe UI"
                                     IsReadOnly="True"
                                     BorderBrush="#FF1F4E79" 
                                     BorderThickness="0" 
                                     HorizontalAlignment="Center" FontSize="84"
                                     TextWrapping="Wrap" AcceptsReturn="True" 
                                     Background="#FF1F4E79" 
                                     Text="Welcome"
                                    />
                    <TextBlock x:Name="WelcomeTextException2"
                                     RelativePanel.AlignLeftWithPanel="True"
                                     RelativePanel.Below="WelcomeText"
                                     Margin="215,0,0,0"
                                     Foreground="White"
                                     FontFamily="Segoe UI"


                                     HorizontalAlignment="Center" FontSize="34"



                                    />
                </RelativePanel>
           <RelativePanel x:Name="relFvWelcome" RelativePanel.Below="WelcomeRelativePanelUserControl">
            <FlipView x:Name="fvWelcome" 
                      VerticalAlignment="Center" 
                      Background="#FF1F4E79"

                      RelativePanel.AlignBottomWithPanel="True"
                      >



                <FlipView.Triggers>



                    <EventTrigger>
                        <BeginStoryboard>
                            <Storyboard x:Name="FlpVOpacity">
                                <DoubleAnimation
                                          Storyboard.TargetName="fvWelcome"
                                          Storyboard.TargetProperty="(FlipView.Opacity)"
                                          AutoReverse="True"
                                          From="0" To="1" Duration="0:0:4" 
                                          RepeatBehavior="1x" 
                                          />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </FlipView.Triggers>

                <FlipView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel Orientation="Vertical"/>
                    </ItemsPanelTemplate>
                </FlipView.ItemsPanel>

                <FlipView.ItemTemplate >


                <DataTemplate>


                        <TextBox x:Name="GuestNameTextBox"

                                 Grid.Row="1"
                                 IsReadOnly="True"
                                 Foreground="White"
                                 Margin="145,0,0,0"
                                 FontFamily="Segoe UI"
                                 BorderBrush="#FF1F4E79" 
                                 BorderThickness="0" Text="{Binding}" 
                                 FontSize="84"
                                 TextWrapping="Wrap" AcceptsReturn="True" 
                                 Background="#FF1F4E79" 
                                >






                            </TextBox>

                                            </DataTemplate>

                </FlipView.ItemTemplate>
            </FlipView>


        </RelativePanel>
        </RelativePanel>