locked
Google Analytics in OOB Silverlight App RRS feed

  • Question

  • Hi All,

    I am trying to integrate Google Analytics into my silver light out of browser application. I am using Blend 4, VS 2010 and MSAF 1.4.10

    I have include the following code in my 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>

    In the Main Page.XAML under the Grid i have added this code:

    <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>

    when i run this it gives me an error as :
    Add value to collection of type 'System.Windows.Interactivity.TriggerCollection' threw an exception.

    Am i Missing something here?

    Please guide me in this.

     


    Thanks by Manivel
    Wednesday, July 27, 2011 1:36 PM

All replies

  • The xaml you posted seems correct.
    Wednesday, July 27, 2011 2:13 PM
    Moderator
  • HI Chuck Hays,

     

    But the above xaml is getting error on runtime as Add value to collection of type 'System.Windows.Interactivity.TriggerCollection' threw an exception. 


    Thanks by Manivel
    Thursday, July 28, 2011 7:14 AM