/// <summary> /// Adds a new item to a ContextPopup object with label and icon. /// </summary> /// <param name="label">The Label of the new item</param> /// <param name="icon">Icon to be set on new item</param> /// <returns>A ContextPopupItem added or NULL, on errors</returns> /// <since_tizen> preview </since_tizen> public ContextPopupItem Append(string label, EvasObject icon) { ContextPopupItem item = new ContextPopupItem(label, icon); item.Handle = Interop.Elementary.elm_ctxpopup_item_append(RealHandle, label, icon, _onSelected, (IntPtr)item.Id); AddInternal(item); return item; }
/// <summary> /// Creates and initializes a new instance of the ContextPopup class. /// </summary> /// <param name="parent">The parent is a given container, which will be attached by ContextPopup /// as a child. It's <see cref="EvasObject"/> type.</param> /// <since_tizen> preview </since_tizen> public ContextPopup(EvasObject parent) : base(parent) { _dismissed = new SmartEvent(this, this.RealHandle, "dismissed"); _dismissed.On += (sender, e) => { Dismissed?.Invoke(this, EventArgs.Empty); }; _onSelected = (data, obj, info) => { ContextPopupItem item = ItemObject.GetItemById((int)data) as ContextPopupItem; item?.SendSelected(); }; }
void AddInternal(ContextPopupItem item) { _children.Add(item); item.Deleted += Item_Deleted; }