2014-09-22 24 views
0

我在设计一个xaml页面,如果我不插入toolkit:TiltEffect.IsTiltEnabled =“True”我的页面有一个“无效的XA​​ML”。 下面是完整的页面:toolkit:TiltEffect.IsTiltEnabled不起作用

<phone:PhoneApplicationPage 
    x:Class="SolLongListSelector_WinPhone8.Page1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" 
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" 
    FontFamily="{StaticResource PhoneFontFamilyNormal}" 
    FontSize="{StaticResource PhoneFontSizeNormal}" 
    Foreground="{StaticResource PhoneForegroundBrush}" 
    SupportedOrientations="Portrait" Orientation="Portrait" 

    shell:SystemTray.IsVisible="True"> 

    <!--LayoutRoot is the root grid where all page content is placed--> 
    <Grid x:Name="LayoutRoot" Background="Transparent"> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="Auto"/> 
      <RowDefinition Height="*"/> 
     </Grid.RowDefinitions> 

     <!--ContentPanel - place additional content here--> 


     <!-- Slide Show with Pivot Control --> 
     <controls:Pivot 
       Grid.Row="0" 
       Grid.Column="0" 
       Name="slide_show" 
       Margin="0,-100,0,0" 
       SelectionChanged="slide_show_SelectionChanged"> 

      <!-- Pivot item template --> 
      <controls:Pivot.ItemTemplate> 
       <DataTemplate> 
        <Image Name="img" 
          CacheMode="BitmapCache" 
          Source="{Binding image}" 
          HorizontalAlignment="Stretch" 
          VerticalAlignment="Stretch" 
          Stretch="Uniform" 
          toolkit:TiltEffect.IsTiltEnabled="True" 
          /> 
       </DataTemplate> 
      </controls:Pivot.ItemTemplate> 
     </controls:Pivot> 


    </Grid> 
</phone:PhoneApplicationPage> 

我想脱下TiltEffect.IsTiltEnabled但我不能!还保留它给了我一个错误: 错误10名称“TiltEffect”不存在于命名空间“clr-namespace:Microsoft.Phone.Controls;程序集= Microsoft.Phone.Controls.Toolkit”中。

任何想法? 谢谢

+1

像埃里克说的,你可能忘了添加它作为参考。我有一步一步的说明,通过使用NuGet在这里:http://stackoverflow.com/questions/25703114/windows-phone-8-1-silverlight-and-xaml/25705317?noredirect=1#comment40560052_25705317 – 2014-09-23 00:35:36

回答

1

请确保您安装了Windows Phone Toolkit。 TiltEffect不是Windows Phone SDK的一部分。这很可能是你得到这些错误的原因。

0

转到查看 - >其他窗口 - >包管理器控制台,键入以下命令并按回车。

Install-Package WPtoolkit

它安装更新的Windows Phone工具包,它工作正常。

+0

已安装! PM>安装包WPtoolkit 已安装'WPtoolkit 4.2013.08.16'。 SolLongListSelector_WinPhone8已经引用了'WPtoolkit 4.2013.08.16'。 – user2348511 2014-09-23 15:49:20

+0

如果这不起作用,我可以给你替代解决方案。只需在此链接中添加此TileEffect.cs https://github.com/BalasubramaniM/HelperClass/blob/master/TiltEffect.cs,使用您的项目名称更改名称空间并构建项目。添加引用,xmlns:local =“clr-namespace:[Namespace]”并使用控件as,local:TiltEffect.IsTiltEnabled =“True”。希望它可以帮助你。 – 2014-09-24 05:07:48