Behavior Missing References?

762
2
Jump to solution
12-27-2012 11:31 AM
BrianLeroux
Occasional Contributor III
I am trying to create my first behavior using silverlight 3.0 api and silverlight 5. For some reason I have an error with "[Export(typeof(Behavior<Map>))]" saying that I have a missing type or namespace. I also have the same issue on base.OnAttached();. I am taking these from the Zoom to Selected Layer sample. Anyone have any ideas.

using System; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; //using System.Windows.Interactivity; using System.ComponentModel.Composition; using ESRI.ArcGIS.Client; using ESRI.ArcGIS.Client.Extensibility; using ESRI.ArcGIS.Client.Geometry; using ESRI.ArcGIS.Client.Tasks; using ESRI.ArcGIS.Client.Behaviors; using System.Windows.Threading;  namespace ECFMapLoad.AddIns {     [Export(typeof(Behavior<Map>))]     [DisplayName("Load ECF Data")]     public class MyBehavior : Behavior<Map>     {                 #region Behavior Overrides         protected override void OnAttached()         {             base.OnAttached();             // Show saved configuration text             MapApplication.Current.Initialized += Initialized;                      }          private void Initialized(object sender, EventArgs args)         {                      }         protected override void OnDetaching()         {             // Detach the event handler             MapApplication.Current.Initialized -= Initialized;             base.OnDetaching();                     }                          #endregion     } }
0 Kudos
1 Solution

Accepted Solutions
KatherineDalton
Esri Regular Contributor
Hi Brian,

You'll definitely need the using statement for System.Windows.Interactivity, since that's what gives access to the Behaviors. You might want to try starting from a blank Visual Studio template and using the MyBehavior.cs file that is included as an example.

Also, double-check that you have the Microsoft Expression Blend Preview for Silverlight 5 installed.

Katy
Katy Dalton | Technical Consultant
THE SCIENCE OF WHERE™

View solution in original post

0 Kudos
2 Replies
KatherineDalton
Esri Regular Contributor
Hi Brian,

You'll definitely need the using statement for System.Windows.Interactivity, since that's what gives access to the Behaviors. You might want to try starting from a blank Visual Studio template and using the MyBehavior.cs file that is included as an example.

Also, double-check that you have the Microsoft Expression Blend Preview for Silverlight 5 installed.

Katy
Katy Dalton | Technical Consultant
THE SCIENCE OF WHERE™
0 Kudos
BrianLeroux
Occasional Contributor III
I did not install Microsoft Expression Blend Preview for Silverlight 5 after I upgraded everything. I guessed I missed that step. Thank you!
0 Kudos