// ----------------------------------------------------------------------- // // Copyright 2015 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- namespace Perspex.Controls { using Perspex.Controls.Primitives; using Perspex.Input; public class MenuItem : HeaderedItemsControl { public static readonly PerspexProperty IconProperty = PerspexProperty.Register("Icon"); public static readonly PerspexProperty IsSubMenuOpenProperty = PerspexProperty.Register("IsSubMenuOpen"); public object Icon { get { return this.GetValue(IconProperty); } set { this.SetValue(IconProperty, value); } } public bool IsSubMenuOpen { get { return this.GetValue(IsSubMenuOpenProperty); } set { this.SetValue(IsSubMenuOpenProperty, value); } } protected override void OnPointerPressed(PointerPressEventArgs e) { base.OnPointerPressed(e); this.IsSubMenuOpen = !this.IsSubMenuOpen; } } }