PositionOrigin Structure

PositionOrigin Structure

Bing
 

Represents the anchor point of UIElement, such as an image, at a Location on a MapLayer.

Namespace:   Microsoft.Maps.MapControl.WPF
Assembly:  Microsoft.Maps.MapControl.WPF (in Microsoft.Maps.MapControl.WPF.dll)

[TypeConverterAttribute(typeof(PositionOriginConverter))]
public struct PositionOrigin

NameDescription
System_CAPS_pubmethodPositionOrigin(Double, Double)

Initializes a new instance of the PositionOrigin class.

NameDescription
System_CAPS_pubpropertyX

Gets or sets the x-axis position of the position origin.

System_CAPS_pubpropertyY

Gets or sets the y-axis position of the position origin.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to this position origin.(Overrides ValueType.Equals(Object).)

System_CAPS_pubmethodEquals(PositionOrigin)

Determines whether the specified position origin is equal to this position origin.

System_CAPS_pubmethodGetHashCode()

Retrieves the hash code for this position origin.(Overrides ValueType.GetHashCode().)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from ValueType.)

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticBottomCenter

Specifies the bottom center of the position.

System_CAPS_pubfieldSystem_CAPS_staticBottomLeft

Specifies the bottom left of the position.

System_CAPS_pubfieldSystem_CAPS_staticBottomRight

Specifies the bottom right of the position.

System_CAPS_pubfieldSystem_CAPS_staticCenter

Specifies the center of the position.

System_CAPS_pubfieldSystem_CAPS_staticCenterLeft

Specifies the center left of the position.

System_CAPS_pubfieldSystem_CAPS_staticCenterRight

Specifies the center right of the position.

System_CAPS_pubfieldSystem_CAPS_staticTopCenter

Specifies the top center of the position.

System_CAPS_pubfieldSystem_CAPS_staticTopLeft

Specifies the top left of the position.

System_CAPS_pubfieldSystem_CAPS_staticTopRight

Specifies the top right of the position.

NameDescription
System_CAPS_puboperatorSystem_CAPS_staticEquality(PositionOrigin, PositionOrigin)

Determines whether two position origin objects are equal.

System_CAPS_puboperatorSystem_CAPS_staticInequality(PositionOrigin, PositionOrigin)

Determines whether two position origins are not equal.

This property defines the anchor point of a UIElement by specifying an enumeration value or providing a pair of coordinate values between 0 and 1 where (0,0) is the top-left coordinate and (1,1) is the bottom-right coordinate.

The following example shows how to add an image to a map layer and set the anchor point of the image by using the PositionOrigin property. For the complete code, see Adding Media to the Map.

private void addImageToMap(object sender, RoutedEventArgs e)
{
    MapLayer imageLayer = new MapLayer();


    Image image = new Image();
    image.Height = 150;
    //Define the URI location of the image
    BitmapImage myBitmapImage = new BitmapImage();
    myBitmapImage.BeginInit();
    myBitmapImage.UriSource = new Uri("http://upload.wikimedia.org/wikipedia/commons/d/d4/Golden_Gate_Bridge10.JPG");
    // To save significant application memory, set the DecodePixelWidth or  
    // DecodePixelHeight of the BitmapImage value of the image source to the desired 
    // height or width of the rendered image. If you don't do this, the application will 
    // cache the image as though it were rendered as its normal size rather then just 
    // the size that is displayed.
    // Note: In order to preserve aspect ratio, set DecodePixelWidth
    // or DecodePixelHeight but not both.
    //Define the image display properties
    myBitmapImage.DecodePixelHeight = 150;
    myBitmapImage.EndInit();
    image.Source = myBitmapImage;
    image.Opacity = 0.6;
    image.Stretch = System.Windows.Media.Stretch.None;

    //The map location to place the image at
    Location location = new Location() { Latitude = 37.8197222222222, Longitude = -122.478611111111 };
    //Center the image around the location specified
    PositionOrigin position = PositionOrigin.Center;

    //Add the image to the defined map layer
    imageLayer.AddChild(image, location, position);
    //Add the image layer to the map
    myMap.Children.Add(imageLayer);
}


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft