This documentation is archived and is not being maintained.

ContextMenu.HorizontalOffset Property

Gets or sets where along the x-direction to place the ContextMenu with respect to the parent control.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[BindableAttribute(true)] 
[TypeConverterAttribute(typeof(LengthConverter))] 
public double HorizontalOffset { get; set; }
/** @property */
public double get_HorizontalOffset ()

/** @property */
public void set_HorizontalOffset (double value)

public function get HorizontalOffset () : double

public function set HorizontalOffset (value : double)

<object HorizontalOffset="double"/>
- or –
<object HorizontalOffset ="qualifiedDouble"/>
 double   Double  String representation of a Double value. This is interpreted as a device-independent unit (1/96th inch) measurement. Strings need not explicitly include decimal points. For instance a value of 1 is acceptable.  The same Double range restrictions as mentioned in the Property Value section apply.  qualifiedDouble  A double value as described above, followed by one of the following unit declaration strings: px, in, cm, pt.  px (default) is device-independent units (1/96th inch per unit)  in is inches; 1in==96px  cm is centimeters; 1cm==(96/2.54) px  pt is points; 1pt==(96/72) px  Note   In many cases a double may be set to Auto but a ContextMenu will not appear if the offsets are set to Auto. 

Property Value

A Double that represents the horizontal offset of the ContextMenu. This property cannot be set to a negative number. The default value is zero (0).

The following example shows how to use the HorizontalOffset property to cause a ContextMenu to open at a specified location in relation to its button parent.

<ContextMenu HorizontalOffset="50" VerticalOffset="50" HasDropShadow="false">

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: