locked
Namespace issue Interactivity and Interactions... RRS feed

  • Question

  • Hello all, I have come across a slight issue this morning relating to namespaces. I was able to build and run my project a couple of weeks ago absoloutely fine. I opened my solution this morning and got the following error:

    The name EventTrigger does not exist in this namespace http://schemas.microsoft.com/expression/2010/interactivity. 

    Not entirely sure how to fix it. I have the latest silverlight version installed... My XAML looks like this.

    As always thanks in advance :) I have removed the code temporarily (I may even have to redo it) but would like to know what caused it.

    <UserControl
    	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    	xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    	xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
    	xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
    	xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
    	xmlns:ee="http://schemas.microsoft.com/expression/2010/effects" 
    	x:Name="userControl"
    	mc:Ignorable="d"
    	x:Class="ReACTSL.SectionControl" Foreground="{x:Null}">
    
    	<Grid x:Name="LayoutRoot" Background="White">
    		<VisualStateManager.VisualStateGroups>
    			<VisualStateGroup x:Name="CollapseExpandGroup">
    				<VisualState x:Name="Collapse">
    					<Storyboard>
    						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="pnlQuestion">
    							<DiscreteObjectKeyFrame KeyTime="0">
    								<DiscreteObjectKeyFrame.Value>
    									<Visibility>Collapsed</Visibility>
    								</DiscreteObjectKeyFrame.Value>
    							</DiscreteObjectKeyFrame>
    						</ObjectAnimationUsingKeyFrames>
    						<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="btnExpand1" d:IsOptimized="True"/>
    						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(ContentControl.Content)" Storyboard.TargetName="btnExpand1">
    							<DiscreteObjectKeyFrame KeyTime="0" Value="Expand"/>
    						</ObjectAnimationUsingKeyFrames>
    					</Storyboard>
    				</VisualState>
    				<VisualState x:Name="Expand">
    					<Storyboard>
    						<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="btnCollapse" d:IsOptimized="True"/>
    						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(ContentControl.Content)" Storyboard.TargetName="btnCollapse">
    							<DiscreteObjectKeyFrame KeyTime="0" Value="Collapse"/>
    						</ObjectAnimationUsingKeyFrames>
    						<DoubleAnimation Duration="0" To="-86" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="btnCollapse" d:IsOptimized="True"/>
    						<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="btnCollapse" d:IsOptimized="True"/>
    					</Storyboard>
    				</VisualState>
    			</VisualStateGroup>
    		</VisualStateManager.VisualStateGroups>
    		<Grid.ColumnDefinitions>
    			<ColumnDefinition Width="0.069*"/>
    			<ColumnDefinition Width="0.011"/>
    		</Grid.ColumnDefinitions>
    		<StackPanel Margin="2,10,0,0" Background="White">
    			<i:Interaction.Triggers>
    				<i:EventTrigger EventName="Click" SourceObject="{Binding ElementName=btnCollapse}">
    					<ei:GoToStateAction x:Name="GoToCollapse" StateName="Collapse"/>
    				</i:EventTrigger>
    				<i:EventTrigger EventName="Loaded">
    					<ei:GoToStateAction x:Name="OnLoad" StateName="Expand"/>
    				</i:EventTrigger>
    				<i:EventTrigger EventName="Click" SourceObject="{Binding ElementName=btnExpand1}">
    					<ei:GoToStateAction x:Name="GoToExpand" StateName="Expand"/>
    				</i:EventTrigger>
    			</i:Interaction.Triggers>
    			<StackPanel Height="45" Margin="0,5,0,0" Orientation="Horizontal" Background="{StaticResource CurveBlockBackground}">
    				<sdk:Label Width="110" Margin="7,10,0,10" Content="Section Name:" Foreground="White"/>
    				<TextBox x:Name="txtName" TextWrapping="Wrap" TextChanged="txtName_TextChanged" Margin="0,10" Width="292"/>
            <Button ToolTipService.ToolTip="Add new" x:Name="linkAddQuestion" Click="linkAddQuestion_Click" Style="{StaticResource IconButton}" Cursor="Hand" Margin="0,5,0,19">
    					<Image Source="plus_16.png" Width="16" Height="16" Margin="2,0,10,0" ToolTipService.ToolTip="Add Question" />
    				</Button>
            <StackPanel Orientation="Horizontal" Margin="0,0,0,5">
            	<Button x:Name="btnDelete" Content="Delete" Height="28" Click="btnDelete_Click" HorizontalAlignment="Right" Margin="0,5,10,5" />
              <Button x:Name="btnExpand1" Content="Expand" Height="28" HorizontalAlignment="Right" Margin="0,6,10,6" Opacity="0" />
              <Button x:Name="btnCollapse" Content="Collapse" Height="28" HorizontalAlignment="Right" Margin="0,6,10,6" Opacity="0" RenderTransformOrigin="0.5,0.5" >
              	<Button.RenderTransform>
              		<CompositeTransform/>
              	</Button.RenderTransform>
              </Button>
            </StackPanel>
    			</StackPanel>
    			<StackPanel x:Name="pnlQuestion" MinHeight="20"/>
    		</StackPanel>
    		
    	</Grid>
    </UserControl>
    Tuesday, May 3, 2011 9:49 AM

Answers

  • Sounds strange that they got removed, maybe if you were working in both VS and Blend one saved over the project file after the other had added the references? Hard to say.

    I don't know if the Expression Blend SDK assemblies get registered in the .Net tab list. You should be able to find them in this path:

    C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\Silverlight\v4.0\Libraries

    • Proposed as answer by Chuck HaysModerator Wednesday, May 4, 2011 1:28 PM
    • Marked as answer by OnamC Wednesday, May 4, 2011 3:29 PM
    Wednesday, May 4, 2011 1:27 PM
    Moderator

All replies

  • Looks like your project no longer has a reference to System.Windows.Interactivity.dll or Microsoft.Expression.Interactions.dll. Check the references section of your project for those.
    Tuesday, May 3, 2011 1:37 PM
    Moderator
  • I don't believe I have ever referenced those DLLs... at least they aren't broken?
    Tuesday, May 3, 2011 3:32 PM
  • Blend will add those references automatically if you create a behavior by dragging it from the asset panel to the artboard. They may have gotten added that way.
    Tuesday, May 3, 2011 3:33 PM
    Moderator
  • I thought it might do that. However, isn't it strange that it has somehow lost it? I tried re-adding that DLL by right clicking the project > add reference > .NET and it doesn't seem to exist...

    Do I need to browse to it? Am I wrong in thinking it should appear in the .NET tab?

    Wednesday, May 4, 2011 11:01 AM
  • Sounds strange that they got removed, maybe if you were working in both VS and Blend one saved over the project file after the other had added the references? Hard to say.

    I don't know if the Expression Blend SDK assemblies get registered in the .Net tab list. You should be able to find them in this path:

    C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\Silverlight\v4.0\Libraries

    • Proposed as answer by Chuck HaysModerator Wednesday, May 4, 2011 1:28 PM
    • Marked as answer by OnamC Wednesday, May 4, 2011 3:29 PM
    Wednesday, May 4, 2011 1:27 PM
    Moderator
  • Oh wow that has sorted it. How it lost those references only god knows. I did exactly what you said and it has worked a peach!

    It is interesting though that you said it may have occurred because of having Expression and Visual Studio open at the same time as I added the references within Visual Studio and I flicked back to Expression and these new references do not appear. Maybe I closed Visual Studio first and then saved changes in Expression which essentially removed all my recent references that I added... wild guess but possible I guess?

    Thank you though it has provided some much needed relief :)

    Wednesday, May 4, 2011 3:34 PM
  • VS modifies your project file but doesn't save it until something forces it. A save all (ctrl shift s) will force a save of the project file. Once that happens Blend will notice the changes.
    Wednesday, May 4, 2011 3:40 PM
    Moderator