【问题标题】:Xamarin Forms The type TouchEffect was not foundXamarin Forms 未找到类型 TouchEffect
【发布时间】:2019-11-25 23:05:19
【问题描述】:

我想使用这个 xaml 代码:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:skia="clr-namespace:SkiaSharp.Views.Forms;assembly=SkiaSharp.Views.Forms"
             xmlns:tt="clr-namespace:TouchTracking;assembly=TouchTracking"
             mc:Ignorable="d"
             x:Class="MyApp.MemeBuilder"
             BackgroundColor="#212121">
    <ContentPage.Content>
        <Grid BackgroundColor="White">
            <skia:SKCanvasView x:Name="MyCanvas"
                           PaintSurface="OnCanvasViewPaintSurface" />
            <Grid.Effects>
                <tt:TouchEffect  Capture="True"
                            TouchAction="OnTouchEffectAction" />
            </Grid.Effects>
        </Grid>
    </ContentPage.Content>
</ContentPage>

我安装了skiasharp和nuget-package TouchTracking,但我仍然收到错误:

类型 tt:TouchEffect 未找到

我该如何解决这个问题?

【问题讨论】:

  • 关闭 IDE 并重新打开并进行重建。
  • TouchTracking 在这种情况下不是 nuget 包
  • 重新打开重建后还是一样的错误
  • 您需要在您的项目中包含 TouchEffect.cs - 它是您从中复制的示例项目的一部分

标签: xaml xamarin xamarin.forms


【解决方案1】:

看起来您正在表单中使用触摸跟踪库。您的程序集引用不正确。下面一个应该可以工作:

xmlns:tt="clr-namespace:TouchTracking.Forms;assembly=TouchTracking.Forms"

另外,请确保安装“TouchTracking.Forms”nuget 包而不是“TouchTracking”。

更多信息在这里:https://github.com/OndrejKunc/SkiaScene#touchtrackingforms

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-05-13
    • 1970-01-01
    • 1970-01-01
    • 2017-10-09
    • 1970-01-01
    • 2017-08-29
    • 2021-09-23
    相关资源
    最近更新 更多