Select to view content in your preferred language

Featurelayer problem in V2 Beta version.

590
4
05-27-2010 02:05 PM
DeminHu
Deactivated User
Hi,

I   feel a  problem with FeatureLayer in V2 Beta, but I am not sure  if ESRI designs FeatureLayer in V2 just like this way or not.

in V1.2, I used to do the following in .xmal file, then in the code behind, I set URL dynamically. Everything was fine.

<esri:FeatureLayer ID="FLayer" >
                        <esri:FeatureLayer.OutFields>
                            <sys:String>*</sys:String>
                        </esri:FeatureLayer.OutFields>
          esri:FeatureLayer>

But now, with V2.0 beta version, if I didn't set a default URL in the .xmal file, it would not successfullu compile, and always got the error. If i set a URL in the .xaml file, there would no problem . But if I set a URL in .xaml file, then the user clicked  a button , then reset the URL for the featurelayer in the code,  then you didn't see the change displayed on the map, click again, the change showed on the map. So it need click twice. Finally, I had to use GraphicsLayer instead of FeatureLayer for my purpose. The GraphicLayer seems fine.

Is there any body has such experiences with FeatureLayer in V2 beta?

Thanks.
0 Kudos
4 Replies
DominiqueBroux
Esri Frequent Contributor
I have not reproduced the compile error when a feature layer has no URL.

What is exactly the error you get?
0 Kudos
DeminHu
Deactivated User
Hi,

Thanks for help.

After read your reply, I recreated a new peoject with  standard template, I added a feautelayer as the following:
<esri:FeatureLayer ID="FLayer" > </esri:FeatureLayer>

Now, I could compile successfully, but when  I tried to run, the map  could not be dispalyed, IE browser show: Error on page. I did the same on my working app which created with show case template, it was the same.

As soon as I removed or set a default URL for Featurelayer in .xaml , everything was OK.

I forgot what exactly error meesage showed before, since it was a few week ago. it seems something like: the tag already declared in app.xaml.  But as I  tested now, as long as I set a default URL in .xaml, it was Ok, no error.

I don't know what is wrong? now, I am using Graphicslayer instead for my  purpose, but if I can fix the problem , use the featurelayer, it will help me  a lot.

Thanks again.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Hook up to the 'InitializationFailed' event (even if you are doing nothing in 'FeatureLayer_InitializationFailed').
This will prevent the system to throw an exception if the initialization of the layer fails.

 <esri:FeatureLayer ID="ID=FLayer" InitializationFailed="FeatureLayer_InitializationFailed"/>
0 Kudos
DeminHu
Deactivated User
Thanks for the  suggestion !!
0 Kudos