2012-03-23 85 views
0
An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll 

Additional information: 'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '54' and line position '22'. 

我試圖運行下面的XAML件WPF嘗試了一個簡單的人物動畫

  <Border Background="AliceBlue" CornerRadius="33" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    VerticalAlignment="top" HorizontalAlignment="Center" BorderThickness="0" BorderBrush="#ccc" Padding="10" SnapsToDevicePixels="True" Width="298" Margin="113,12,117,0"> 
     <TextBlock FontFamily="Comic Sans MS" 
        FontSize="25" 
        TextWrapping="Wrap" 
        x:Name="txtBlkThanks" 
        Foreground="Gray"       
        Width="198" Height="39" 
        > 
      Clap your hands 
      <TextBlock.Triggers> 
       <EventTrigger RoutedEvent="TextBlock.Loaded"> 
        <BeginStoryboard> 
         <Storyboard> 
          <StringAnimationUsingKeyFrames Storyboard.TargetName="txtBlkThanks" 
                  Storyboard.TargetProperty="(TextBlock.Content)" 
                  Duration="0:0:8" 
                  FillBehavior="HoldEnd"> 
           <DiscreteStringKeyFrame Value="" KeyTime="0:0:0"/> 
           <DiscreteStringKeyFrame Value="C" KeyTime="0:0:1"/>                   
           <DiscreteStringKeyFrame Value="Cl" KeyTime="0:0:1.5"/>                   
           <DiscreteStringKeyFrame Value="Cla" KeyTime="0:0:2"/>                   
           <DiscreteStringKeyFrame Value="Clap" KeyTime="0:0:2.5"/>                   
           <DiscreteStringKeyFrame Value="Clap y" KeyTime="0:0:3"/>                   
           <DiscreteStringKeyFrame Value="Clap yo" KeyTime="0:0:3.5"/>                   
           <DiscreteStringKeyFrame Value="Clap you" KeyTime="0:0:4"/> 
           <DiscreteStringKeyFrame Value="Clap your" KeyTime="0:0:4.5"/>                   
           <DiscreteStringKeyFrame Value="Clap your h" KeyTime="0:0:5"/>                   
           <DiscreteStringKeyFrame Value="Clap your ha" KeyTime="0:0:5.5"/>                   
           <DiscreteStringKeyFrame Value="Clap your han" KeyTime="0:0:6"/>                   
           <DiscreteStringKeyFrame Value="Clap your hand" KeyTime="0:0:6.5"/>                   
           <DiscreteStringKeyFrame Value="Clap your hands" KeyTime="0:0:7"/>                  
          </StringAnimationUsingKeyFrames> 
         </Storyboard> 
        </BeginStoryboard> 
       </EventTrigger> 
      </TextBlock.Triggers> 
     </TextBlock> 
    </Border> 

我想動畫「拍拍手」,當遇到這個錯誤時,拋出一個異常時,文本塊在加載窗口時加載。 謝謝

回答

2

我認爲問題在於你試圖綁定到TextBlock.Content。但是TextBlock具有「Text」屬性,它不是ContentControl。所以如果你把它改爲「文本」,你應該沒問題。