how to get coordinate of control in windows phone 7 - windows-phone-7

i want to know how to get coordinate (x,y) of 2 Textboxes and compare each others, i saw some code use GeoCoordinate then i try it but i don't know why my visual studio doesn't support that library, help me and give me some code example for get (x,y) of controls, i'm using visual studio 2010 and OS 7.1

I think GeoCoordinate is for GPS position, you can't use it to localise control in a grid.
However, you can use this code to localise control relatively to a grid or a stackPanel thank to the code below :
var transform1 = textBox1.TransformToVisual(grid);//Grid is your content panel
Point absolutePosition1 = transform1.Transform(new Point(0, 0));
var transform2 = textBox2.TransformToVisual(grid);//Grid is your content panel
Point absolutePosition2 = transform2.Transform(new Point(0, 0));
After that, you can compare them.

Related

Using Vector pdf Image in Xamarin IOS

In my Xamarin.IOS visual studio project, I wanted to use Vector pdf image in an UIImageView. But I am not able to add the vector image directly in the storyboard designer (also tried drag-drop).
Is there a way to use Vector pdf image in xamarin IOS?
Any sample would be much helpful.
Thanks.
Yes, As lowleetak said, We need to add the pdf file into the asset first.
Xamarin tutorial here , just follow the step ,it's simple.
Edit:
there is no option to select the Attributes Inspector for setting the Scales to Single Vector in Visual Studio. Is there an alternative for this?
AFAIK,there is no option to set the scale for the vector , maybe you could set this property when generate the pdf file.
I want to handle click event to capture the image X Y co-ordinates in C#. Is there a way to do this?
Override the touch event . documentation here.
Code :
public override void TouchesBegan(NSSet touches, UIEvent evt)
{
var touch = touches.AnyObject as UITouch;
CGPoint point = touch.GetPreciseLocation(yourImage);
}
Update:
On iPhone5:
On iPhone6
And this are the constraints
You will need to add the pdf images to asset catalog first (Images.xcassets). You can refer to the guide HERE. It is a guide for Xcode but should be quite the same in Visual Studio.

Center of an Image - Windows Phone

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.

How do windows phone app orientation work?

I am trying to make my first app using XNA, and I am having some issues with orientation and coordinates.
By default, my phone emulator is in portrait mode, but (0,0) is in the top right corner, and X and Y seem to be switched. from how I would expect them to be (x goes up, y goes across)
In my code, I try changing the orientation something similar to
SupportedOrientations = SupportedPageOrientation.Portrait;
SupportedOrientations.FullScreen = true;
And when I do this, it fixes the coordinate problems I am having, but then the screen becomes just a little square.
any ideas how to fix this? is this just how it is supposed to be?
Also, does orientation change automatically, or do I need to explicitly add
private void PhoneApplicationPage_OrientationChanging
(object sender,OrientationChangedEventArgs e)
Thanks
In addition to mandating the valid orientations, you should set your PreferredBackBufferWidth and PreferredBackBufferHeight appropriately (480 and 800, respectively, for current WP7). These are both found in the graphics member of the main Game class. You don't need to manually set the orientation.

WP7 background blur effect

I need to know, which is the best way to blur the background of the Windows Phone 7 app to concentrate the user's attention on a "always on top" popup window.
My idea is:
Make an in-memory screenshot of the background grid (by turning it into a freezable or something).
Add an image that overlaps the background grid, but is below (with the z-index) the popup.
Still I doubt I will be able to overlap the application bar.
At this point, if you have a solution, please advise.
A few pointers for you ...
Unfortunately the Silverlight BlurEffect and other Bitmap effects didn't make it into Window Phone 7, so you will have to implement the blur yourself. This is actually pretty simple, just use a Gaussian Convolution Filter.
To achieve this effect you can capture the visuals of your application into a WriteableBitmap, manipulate the image to create your blur, then overlay this image over your application using a PopUp. I did something similar in a blog post I wrote about fly-out text animations here:
http://www.scottlogic.co.uk/blog/colin/2011/04/metro-in-motion-3-flying-titles/
Find your root visual as follows:
var rootElement = Application.Current.RootVisual as FrameworkElement;
Add a copy of this UI into a popup as follows:
_backgroundMask = new Rectangle()
{
Fill = new SolidColorBrush(Colors.Black),
Opacity = 0.0,
Width = rootElement.ActualWidth,
Height = rootElement.ActualHeight
};
_popupCanvas.Children.Add(_backgroundMask);
_targetElementClone = new Image()
{
Source = new WriteableBitmap(element, null)
};
_popupCanvas.Children.Add(_targetElementClone);
And show it:
_popup.IsOpen = true;
I'll leave you to work out how to blur the background!
As an aside, your will not be able to overlay or capture the application bar visuals. Hide it before performing this transformation.
Finally, blurring the background isn't really very 'Metro'. Are you sure you want to do this?
Instead of blurring just use a semi transparent layer over the top of the page.
You should hide the application bar before trying to create such an effect as you won't be able to place anything on top of it.

how to set width,height of telerik RAD Calendar

In my asp.net web site project I want to make rad calendar control smaller programmatically that get rendered by default to the browser(which is quite big for my requirement).I tried setting height and width of the control it doesn't work.How can I fix this?
RadCalendar calendar = new RadCalendar();
calendar.Width = x;
calendar.Height = y;
Panel1.Controls.Add(calendar);
Each of the Telerik Skins actually have a minimum height and width setting for the RadCalendar in order to ensure that the visual styles of the control are not broken. As you can imagine modifying the width and height to arbitrary settings could skew the look and feel of the control quite a bit. What you can do, however, is either modify one of the existing skins or create your own. This section in their online documentation covers how to change the appearance, and the specific article covers how to create a custom skin.

Resources