Constrain InfoWindow to window size

3423
21
Jump to solution
02-21-2012 11:28 AM
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
Is there a way to constrain the InfoWindow, when visible, to the size of the browser window?  If a user clicks a point that is close to the top of the browser window, the InfoWindow expands past the top of the page.
[ATTACH=CONFIG]12103[/ATTACH]

Ideally I'd like to shift the map south so that the entire InfoWindow displays.
[ATTACH=CONFIG]12104[/ATTACH]

Any ideas?
0 Kudos
21 Replies
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
Ok. I've set the ContentTemplate in code-behind. No changes.

1- I don't think my InfoWindow is opening behind the map. There's no zIndex set in myMap and looks like there's no zIndex property in the InfoWindow aswell.

2- Yes, my map is contained inside a Grid. I saw the thread you refer, but in my case the infowindow doesnt even appear, while in the other cases the infowindow is appearing in the wrong position...

Thanks for trying to help me.


Try setting a breakpoint in your MouseDown event and see if myinfowindow.isopen returns true.  If it is true, then check the anchorpoint property and see if it falls within the extnent of your map.
0 Kudos
by Anonymous User
Not applicable
Original User: brunno14

Try setting a breakpoint in your MouseDown event and see if myinfowindow.isopen returns true.  If it is true, then check the anchorpoint property and see if it falls within the extnent of your map.


OK.

The IsOpen property returns true.

Under the Anchor property, theres an Extent property with the following values:

XMax  -46.6654243469238
XMin   -46.6654243469238

YMax -23.5543193817139
YMin  -23.5543193817139

And the height and width properties are 0.0, is it normal?

In the Extent property of myMap, there are the following values:

XMax -5188689.952898005
XMin  -5195560.7625789493

YMax -2697750.5551072815
YMin  -2701171.6058885315

Height  3421.05078125
Width  6870.8096809443086

Is there anything wrong?

Thanks
0 Kudos
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
OK.

The IsOpen property returns true.

Under the Anchor property, theres an Extent property with the following values:

XMax  -46.6654243469238
XMin   -46.6654243469238

YMax -23.5543193817139
YMin  -23.5543193817139

And the height and width properties are 0.0, is it normal?

In the Extent property of myMap, there are the following values:

XMax -5188689.952898005
XMin  -5195560.7625789493

YMax -2697750.5551072815
YMin  -2701171.6058885315

Height  3421.05078125
Width  6870.8096809443086

Is there anything wrong?

Thanks


Based on your anchor point, it looks like you are somewhere in Brazil?  But.... Is your map in a different spatial reference?  The coords between the infowindow and the map extent don't seem to line up.  The infowindow is opening, but somewhere else in the world!  Make sure your map spatial ref is in

WKID=4326

0 Kudos
by Anonymous User
Not applicable
Original User: brunno14

Based on your anchor point, it looks like you are somewhere in Brazil?  But.... Is your map in a different spatial reference?  The coords between the infowindow and the map extent don't seem to line up.  The infowindow is opening, but somewhere else in the world!  Make sure your map spatial ref is in

WKID=4326



This seems to be the problem.

I want to show the InfoWindow when user clicks in a graphic, that is an image... This graphic has a spatial reference different than the map...

                            Graphic graphic = new Graphic();
                            graphic.Geometry = new MapPoint(X, Y, new SpatialReference(4326));
                            graphic.Symbol = myImage;


the spatial ref of myMap is 102100...

If I change the graphic's spatial ref to 102100, it appears in the middle of the ocean, but if I set to 4326 it appears in the right place...

What should I do?
0 Kudos
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
What is the source of your point-graphic data?  If it's a feature class (shapefile, GeoDB, etc.) You can either project the source data from 4326 to 102100 or you can define 4326 as the spatial reference for your data frame and let ArcGIS project it on the fly.

Alternatively, you can use a GeometryService to project your graphics coords from 4326 to 102100 right in ArcGIS Server.  See:  http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Project
Use the geometry of your graphic (in 4326) as the input, and use the output(in 102100) as the anchor point of your info window.



0 Kudos
by Anonymous User
Not applicable
Original User: brunno14

What is the source of your point-graphic data?  If it's a feature class (shapefile, GeoDB, etc.) You can either project the source data from 4326 to 102100 or you can define 4326 as the spatial reference for your data frame and let ArcGIS project it on the fly.

Alternatively, you can use a GeometryService to project your graphics coords from 4326 to 102100 right in ArcGIS Server.  See:  http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Project
Use the geometry of your graphic (in 4326) as the input, and use the output(in 102100) as the anchor point of your info window.





I'm using a GeometryService now and my graphics coords are in 102100, just like myMap...

But no changes 😕

My InfoWindow doesnt show up...

I dont know what I'm doing wrong 😕
0 Kudos
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
I was just looking back at some of the previous posts and I see you said you are trying to implement the infoWindow inside a userControl which is not the same page as your map.  Have you tried to use it inside the same page as your map?  Maybe see if you can get it to work in there.  If you can, then maybe that'll give you some hints.  I've never tried to implement the infoWindow on a page that's not the same as my map.  I'm not sure why you would want to.
0 Kudos
by Anonymous User
Not applicable
Original User: brunno14

I was just looking back at some of the previous posts and I see you said you are trying to implement the infoWindow inside a userControl which is not the same page as your map.  Have you tried to use it inside the same page as your map?  Maybe see if you can get it to work in there.  If you can, then maybe that'll give you some hints.  I've never tried to implement the infoWindow on a page that's not the same as my map.  I'm not sure why you would want to.


Let me explain why I need to implement the InfoWindow inside an UserControl....

In my project, I have the MainPage, which contains the map and a toolbar... At this moment, theres no graphics on my map, just the map...

When I click in an option in my toolbar, it shows a "pop up" with some options that I have to choose... The pop up is in a different page (another .xaml) than the map...

In this pop up, there's a button, and when I click on it, it creates a GraphicsLayer, adds the new GraphicsLayer in the Layers property of my Map, create the graphics and add those graphics to the GraphicsLayer...

This works fine...

The problem is that I need to display an InfoWindow when user clicks in any of those graphics...

Is there another way to do this?
0 Kudos
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
You don't need to implement the infowindow inside your usercontrol, you can do it right on the same page as the map (the MainPage). 

Is your graphicslayer defined in your XAML or is it done via codebehind?
0 Kudos
by Anonymous User
Not applicable
Original User: brunno14

You don't need to implement the infowindow inside your usercontrol, you can do it right on the same page as the map (the MainPage). 

Is your graphicslayer defined in your XAML or is it done via codebehind?


via code-behind....
0 Kudos