【问题标题】:Windows Phone - XamlParseExceptionWindows Phone - XamlParseException
【发布时间】:2013-03-17 00:06:30
【问题描述】:

我在导航到我的页面时收到 XamlParseExeption。问题似乎出在工具包 TiltEffect 或 TransitionService 上:

System.Windows.Markup.XamlParseException
  HResult=-2146233087
  Message=Unknown parser error: Scanner 2147500037. [Line: 16 Position: 38]
  Source=System.Windows
  LineNumber=16
  LinePosition=38
  StackTrace:
       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       at ContactChooser.ContactChooserPage.InitializeComponent()
       at ContactChooser.ContactChooserPage..ctor()
  InnerException: 

最后一行是16号:

<phone:PhoneApplicationPage
    x:Class="ContactChooser.ContactChooserPage"
    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:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True"
    toolkit:TiltEffect.IsTiltEnabled="True">

【问题讨论】:

  • 您发布的 sn-p 没有任何问题。您能否展示问题的完整重现并确认您使用的是哪个版本的工具包。
  • 我正在使用 WPToolkit 的 4.2012.10.30 版本。如果在我的代码中设置 Toolkit 的另一个控件,例如 PhoneTextBox,我会得到同样的错误。 Toolkit 本身似乎有问题?

标签: xaml windows-phone-8 windows-phone silverlight-toolkit


【解决方案1】:

我找到了问题。我的解决方案中有两个项目:使用 TiltEffect 的主项目和用于测试主项目的示例项目。该问题的解决方案是我需要在两个项目上添加对 Toolkit 的引用,而不仅仅是在使用该组件的项目上。

【讨论】:

  • 是的,你必须在所有使用它的项目中引用它。
【解决方案2】:

我认为你不应该在整个页面上使用倾斜效果,只在你想要启用倾斜的控件上。

【讨论】:

  • 如果您在页面级别设置它,它将应用于页面中存在的所有它支持的控件。如果您有很多控件并希望将其应用于所有控件,这比将效果应用于单个控件要简单得多。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-06-19
  • 2023-04-03
  • 1970-01-01
相关资源
最近更新 更多