2014-11-06 54 views
0

我已經根據這個不錯的效果創建了翻轉動畫tutorial.當我在Blend中運行動畫時,沒有任何問題和動畫運行。但是,在調試時,整個程序崩潰,出現了錯誤"Cannot resolve TargetName bingMapGrid.",我發現了幾個類似的問題,但沒有解決方案可以解決我的問題。無法解析TargetName ...通過Blend製作的動畫實際上並不工作

動畫與動畫元素:

<Page.Resources> 
    <ResourceDictionary> 
     <Utils:ColorQualityConverter x:Key="ColorQualityConverter"/> 
     <localmain:PinTypeToStyleConverter x:Key="PinTypeToStyleConverter"/> 

     <Storyboard x:Name="FlipOpen"> 
      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="bingMapGrid"> 
       <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/> 
       <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="90"/> 
      </DoubleAnimationUsingKeyFrames> 
      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="mapSmall"> 
       <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="-90"/> 
       <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/> 
      </DoubleAnimationUsingKeyFrames> 
     </Storyboard> 
    </ResourceDictionary> 
</Page.Resources> 

<Grid x:Name="mapPanelSubGrid" Background="#FF323232" Grid.RowSpan="3" Height="768"> 
      <Grid Margin="50,150,50,50">      
        <localmain:CzechMap x:Name="mapSmall" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center" > 
         <localmain:CzechMap.Projection> 
          <PlaneProjection RotationY="-90"/> 
         </localmain:CzechMap.Projection> 
        </localmain:CzechMap> 

        <Grid x:Name="bingMapGrid"> 
         <Grid.Projection> 
          <PlaneProjection/> 
         </Grid.Projection> 
         <bm:Map x:Name="infoMap" ZoomLevel="7.5" Credentials="AhzZ6z0JmgoOrR1vGQx3frGtarXsH36-JMp9Ba9zvNP16UXmIgXF84o2oysH0Sbg" > 
          <bm:Map.Center> 
           <bm:Location Latitude="49.75" Longitude="15.333"/> 
          </bm:Map.Center> 
          <bm:MapLayer Visibility="Visible"> 
           <bm:MapItemsControl x:Name="StationsDetailPinLayer" ItemsSource="{Binding Pinmanager.Pins}"> 
            <bm:MapItemsControl.ItemTemplate> 
             <DataTemplate> 
              <bm:Pushpin Tapped="Pushpin_Hold" 
               BorderBrush="{Binding SelectedBrush}" 
               Background="{Binding Station.Quality, Converter={StaticResource ColorQualityConverter}}" 
               Visibility="{Binding Visibility}" 
               Text="{Binding Station.Quality}"> 
               <bm:MapLayer.Position> 
                <bm:Location Latitude="{Binding Location.Latitude}" Longitude="{Binding Location.Longitude}" /> 
               </bm:MapLayer.Position> 
              </bm:Pushpin> 
             </DataTemplate> 
            </bm:MapItemsControl.ItemTemplate> 
           </bm:MapItemsControl> 
          </bm:MapLayer> 
         </bm:Map> 

        </Grid> 
      </Grid> 
      <AppBarButton x:Name="flipMapButton" HorizontalAlignment="Left" Icon="Map" Label="Detailní mapa" Margin="873,33,0,0" VerticalAlignment="Top" Tapped="flipMapButton_Tapped"/> 
     </Grid> 

編號的起始動畫:

private void flipMapButton_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) 
    { 
     FlipOpen.Begin();    
    } 

預先感謝可能發生的忠告。

回答

0

好的,我在發佈問題後發現瞭解決方案。這有效,即使我不確定爲什麼。

Resources.Add("FlipOpen", FlipOpen); 
: 
((Storyboard)Resources["FlipOpen"]).Begin();