我想谷歌分析整合在我的Silverlight 4出瀏覽器應用程序。當我在XAML像加我的谷歌Analytics(分析)的代碼如下:
使用谷歌Analytics(分析)在Silverlight 4
<i:Interaction.Behaviors>
<ga:GoogleAnalytics WebPropertyId="xxxxxxxxxxxxx"/>
</i:Interaction.Behaviors>
我得到一個錯誤,這是 「增加價值型‘System.Windows.Interactivity.BehaviorCollection’的集合拋出例外。」
的xmlns:I =「HTTP://模式
我無法找到太多的關於這個網幫助,很少在這是我的用戶控件的代碼中指出。 microsoft.com/expression/2010/interactivity」
目前我使用VS 2010和Blend 4本。
感謝您閱讀這一點,如果你能幫助我在這個問題將是巨大的。
編輯:
如前所述,我把數據在這裏:
在我的App.xaml
<Application
x:Class="SilverlightApp.slate.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mwa="clr-namespace:Microsoft.WebAnalytics;assembly=Microsoft.WebAnalytics"
xmlns:ga="clr-namespace:Google.WebAnalytics;assembly=Google.WebAnalytics">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Assets/Styles.xaml"/>
<ResourceDictionary Source="CustomControls.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
<Application.ApplicationLifetimeObjects>
<mwa:WebAnalyticsService>
<mwa:WebAnalyticsService.Services>
<ga:GoogleAnalytics WebPropertyId="XXXXXXXXXXXXX" />
</mwa:WebAnalyticsService.Services>
</mwa:WebAnalyticsService>
</Application.ApplicationLifetimeObjects>
</Application>
在主Page.XAML網格下:
<Button x:Name="btn_library_Icon" Margin="86,2,64,6" Style="{StaticResource menu_librarybuttonstyle}" FontFamily="/SilverlightApp.slate;component/Fonts/Fonts.zip#Segoe UI" FontSize="9.333" Click="btn_library_Icon_Click">
<i:Interaction.Triggers>
<i:EventTrigger SourceName="btn_library_Icon" EventName="Click">
<mwab:TrackAction Category="Library Accessed"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<Image x:Name="image" Source="Assets/icon_menu_library.png" Stretch="Fill" Width="23" Height="23"/>
</Button>
當我運行這個它給了我一個錯誤: 「添加價值型‘System.Windows.Interactivity.TriggerCollection’的集合引發了異常。」
我失去了一些東西?
如在郵件中提到我已加入它作爲以下<應用 MWA:WebAnalyticsService> 但它示出了作爲附加屬性 '服務' 未在類型 'WebAnalyticsService' 發現錯誤。我正在使用最新版本1.4.10 –
感謝您的信息。我在App.xaml文件中添加了信息。現在我試圖在Mainpage.xaml中添加Trigger事件,並且出現以下錯誤:「將值添加到類型'System.Windows.Interactivity.TriggerCollection'的集合中引發了一個異常。」 我已經包含的代碼如下: \t \t \t \t \t \t \t \t i:EventTrigger> \t –
如果您編輯原始p ost包含這些代碼示例。閱讀這篇文章的人更容易閱讀和更容易遵循。此外,它看起來像你在EventTrigger中缺少EventName。我猜它應該是「加載」。 –