I have a bing map and a pin that is to be pinned on the map. This pin is an image different from the default one. I want this image to be pinned on the map, and It does work until here. But it pins at the left-top of the image. I want it to be pinned thru the center of image. (As if you pin a paper on a pinboard not at the left-top of the paper, just thru the center of paper.)
So how can I set this? VerticalAlignment works for this or not?
Here is my pin image definitions;
Image pinimage = new Image();
pinimage.Source = new BitmapImage(new Uri("/Images/killtarget.png", UriKind.Relative));
pinimage.Width = 64;
pinimage.Height = 64;
I use Nokia Map API for Windows Phone 8 and was facing the same issue. I don't know if the same solution will apply to Bing Maps as well but try setting PositionOrigin property of the Pin...it has to be set the following way:-
PositionOrigin="0.5,1"
the two numbers represent alignment horizontally and vertically so 0.5,1 means Horizontally center and Vertically bottom.
Just a bit of clarity. Windows Phone 8 uses a Microsoft created map control that pulls in Nokia map data. This is exactly what Bing Maps does. There was a bit of a miss communication when they announced the new API.
As for centering the image you can try the position origin, or you can use margins with negative x and y values.
Related
I am trying to rotate the pushpin image base on the degree for example "120" to show which direction it is going.
var pushpin = new Microsoft.Maps.Pushpin(curlocation, {
icon: '/images/Airplane_icon.png',
anchor: new Microsoft.Maps.Point(20, 20),
color: 'red'
});
It is possible to rotate a pushpin in Bing Maps but requires a bit of code to achieve. There is a code sample here: https://bingmapsv8samples.azurewebsites.net/#Pushpin_RotatedImage This approach would work fine for a few pushpins, but if you have a lot of pushpins that all have difference rotations, or the rotation of a pushpin is updated frequently, this solution likely wouldn't be the best option.
Another consideration is to take a look at Azure Maps which is another Microsoft mapping platform which does support rotating icons on the map. Here is a sample: https://azuremapscodesamples.azurewebsites.net/index.html?sample=Symbol%20Layer%20Options (click on the icon options tab and move the rotation slider). Azure Maps can handle dynamic rotation values on large data sets easily. Here are a couple of related examples: https://azuremapscodesamples.azurewebsites.net/index.html?sample=Animate%20a%20Symbol%20along%20a%20Path
https://azuremapscodesamples.azurewebsites.net/index.html?sample=Add%20Arrow%20along%20a%20Path
I am trying to implement zoom in zoom out functionality in VC++ MFC framework.As I am new for this facing problem in CDC, Graphics And CscrollView concepts.
Default ZoomLevel is 100% and it's scaling by 20% up/Down (60,80,100,120,140,160).
As I have to Zoom the CRect (i.e some rectangular blocks) along with that some lines which is connected to that Rectangle.
Currently Able to zoom with scrollbar support using Cscrollview but while we zoom at some level for ex. 120% I am expanding canvas size
canvas default page size vertically and horizontally are i.e 5000.
Now while we zoom #120% (canvas size * 120) i.e 6000.
Anyhow after zooming blocks and inside image all are expands properly at all zoom level. But the main problem is Connecter With that rectangle block are
not exactly connected to center its showing some gap.
For that I am attaching one image which showing gap between Block and Connector line.
Before Zoom # default level i.e 100% which looks properly connected:
After Doing zoomin i.e #120% Lines are not connected properly to the Blocks:
As you can see Before and after Zoom rectangle and lines objects showing some gap.That is required to be fixed after doing zoomin/out.
Please let me know, What should be best practise or how to expand/zoom the canvas and its all the objects on it ?
Is there any way if we expand or zoom the view/canvas bitmap object all the object(CREct + Lines + images etc on that canvas also adjusted accordingly?
My requirement for zoomin/zoomout is similar like windows print preview dialog box is providing DefaultView Zoomin and Zoomout option at diffrent level (100,125,150,200 etc).
Or if you have any project reference code related to this please share it will be very big help for me.
How is it possible to determine the horizontal offset of the Windows 8.1 HubControl?
I would like to adjust the margin of my title by the amount of horizontal offset.
Interestingly I notice in the Bing News app that the title 'Bing News' starts off white when it is over the lead image. However, when you scroll right, and the title is now over the application's (light) background (having scrolled past the image), the title background colour now changes to black.
See image below. Shows the top most part of the screen. Images 1-3 show when the page has scrolled right and the BING NEWS title has changed colour once it is no longer over the image.
I assume this is done via the offset again so I hope that my idea is possible.
The Hub control has a child element which is a ScrollViewer. You can parse the visual tree to retrieve the ScrollViewer, or you can use some neat extensions such as the ones in WinRTXamlToolkit which allow you to do a call such as myHubControl.GetFirstDescendentOfType<ScrollViewer>(). Then, you can retrieve the HorizontalOffset from this object.
I have a live tile in my Windows 8 store app which is defined as TileWideImageAndText01 and TileSquarePeekImageAndText04. The image is in an format which doesn't fit the tile, so I guess the tile is taking the center of the picture?
Actually I want the tile to take the top of my picture and not centering it.
Is it possible to change this behaviour in my live tile declaration?
Unfortunately I found out that there is no out-of-the-box-solution for my problem.
I solved it by creating a BitmapResource out of my image, cropping it programmatically and save it back to my ApplicationFolder, where I can reference the image in my live tile with "ms-appdata:///...."
I'm using the mixed XNA/SL programming model where the Silverlight content is rendered by UIElementRenderer. However, it appears that there is a 40 pixel offset between the screen coordinates reported by touch (GestureSample) and the actual coordinates where the contents of the page are rendering.
It appears to be space reserved for the SystemTray in Silverlight apps.
My question is: is there an API I can call to dynamically return this offset so I don't have to hard-code it?
Thanks!
I don't actually think there is any such offset. Since the GestureSample has accurate screen coordinates, your problem is probably with drawing the silverlight UI. Make sure that you don't have any view/projection transforms active on your SpriteBatch when you draw the uiRenderer texture.
If you were using a transform to draw your game scene, you might just want to end that SpriteBatch and start up a new one for screen UI.