I've never got MaintainExtentBehavior worked for my WPF application. I wonder if this function only works for Silverlight? Am I right?I no longer get compiled errors as mentioned in this original post, but got an error at runtime as below:A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dllThis was because I added <i:Interaction.Behaviors> <esriBehaviors:MaintainExtentBehavior x:Uid="meb" /></i:Interaction.Behaviors>I removed the xaml code and tried to add the code below to the behind code as suggested, I didn't get runtime error but the map extent just didn't change when I resized my window. It didn't work.System.Windows.Interactivity.Behavior behavior = new ESRI.ArcGIS.Client.Behaviors.MaintainExtentBehavior();System.Windows.Interactivity.Interaction.GetBehaviors(MyMap).Add(behavior);
I think the SDK sample is correct.Are you using VS 2010 with SL API v2.1? If so, the following is supported xmlns:esri="http://schemas.esri.com/arcgis/client/2009" Any public XAML-able properties that belong to esri namespace, except for the Primitives can be accessed through namespace as long as you have reference to their assemblies. This means you still need to add reference to ESRI.ArcGIS.Client.Behavior.dll in your project in order to do the following:<esri:MaintainExtentBehavior .../>Now that you mentioned the error message, I think the issue is resolving this namespace and adding reference to the correct version in your project. xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"An older may have been installed and it picks up the older version, you can try to add hint path as described here http://forums.silverlight.net/forums/p/194833/453085.aspx
xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
<esri:MaintainExtentBehavior .../>
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
I don't see why you would get this error message. I found this related thread: http://forums.arcgis.com/threads/3323-SL4-Breaks-ESRI-Behaviors Can you try adding the behavior in code-behind? Both methods should work actually (XAML / code-behind).
Maybe the error is unrelated to "x:Uid" then. Have you tried the recreating SDK sample? Was the issue related to xaml namespace definition or referencing the correct assemblies?I think you just need to update this line. xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"The type mismatch may be caused by this. Here's more information about the error you got: http://msdn.microsoft.com/en-us/library/bb546975(v=VS.100).aspx
Kindly look at the SDK sample for MaintainExtentBehavior http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#MaintainExtentBehaviorThe error message in your other post seem related to this. In both cases you were using "x:Uid". Have you tried compiling your app without this?
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.