MenuItem.Icon Property

Gets or sets the icon that appears in a MenuItem.

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

[BindableAttribute(true)] 
public Object Icon { get; set; }
/** @property */
public Object get_Icon ()

/** @property */
public void set_Icon (Object value)

public function get Icon () : Object

public function set Icon (value : Object)

<object>
  <object.Icon>
    <Object .../>
  </object.Icon>
</object>

Property Value

Icon. The default value is null.

Identifier Field

IconProperty

Metadata Flags

None

Many Menu controls have more than just text in the MenuItem elements. Often there are icons, check marks, accelerators, and arrows to indicate submenus.

The following example creates a menu item with an icon.

<MenuItem Header="New">
  <MenuItem.Icon>
    <Image Source="data/cat.png"/>
  </MenuItem.Icon>
</MenuItem>

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

Community Additions

ADD
Show: