private void FillInDeviceSelection(MediaDeviceType deviceType, NSPopUpButton deviceSelection, List <AgoraRtcDeviceInfo> deviceMap) { deviceSelection.RemoveAllItems(); deviceMap.Clear(); var devices = _agoraKit.EnumerateDevices(deviceType); foreach (var device in devices) { deviceSelection.AddItem(device.DeviceName); deviceMap.Add(device); } }
/// <summary> /// Adds the elements associated with a command to a NSPopUpButton. /// </summary> /// <param name="command">The command to associate with the elements in the popup button.</param> /// <param name="button">The button to which the command is to be added.</param> /// <param name="itemTitles">The user-visible names of the items to add to the popup button.</param> /// <param name="itemTags">The identifying information for the choices added to the popup button.</param> /// <param name="itemToolTips">Tool tips for the choices in the popup button.</param> /// <remarks>The NSPopUpButton presents a choice for the user to select. The same command is associated with each choice in the /// button. When the command is invoked, the Tag associated with the item in the popup button is part of the data used in executing the command.</remarks> public static void PopulatePopUpButton(this ICommand command, NSPopUpButton button, string[] itemTitles, int[] itemTags, string[] itemToolTips) { button.RemoveAllItems(); button.AddItems(itemTitles); var menuItems = button.Items(); for (int i = 0; i < menuItems.Length; ++i) { var menuItem = menuItems[i]; menuItem.RepresentedObject = new NSObjectWrapper <ICommand>(command); menuItem.Tag = itemTags[i]; menuItem.ToolTip = itemToolTips[i]; } }
static void AgentPopupButton_Activated(object sender, System.EventArgs e) { var agentName = agentPopupButton.TitleOfSelectedItem; var agent = new Agent(agentName); agentView.ConfigureAgent(agent); agent.Animate(); animationPopupButton.RemoveAllItems(); foreach (var animation in agent.GetAnimations()) { //fill with all animation animationPopupButton.AddItem(animation); } }
public static void Initialize(IScheduler dispatcher) { DropDown.Implementation.Factory = (value, items, nativeLook) => Control.Create(mountLocation => { value = value .ConnectWhile(mountLocation.IsRooted) .AutoInvalidate(); var view = new NSPopUpButton(); var c = nativeLook ? new NSPopUpButtonCell() { BezelStyle = NSBezelStyle.Rounded, } : new CustomPopUpButtonCell(); view.Cell = c; mountLocation.BindNativeDefaults(view, dispatcher); // Disable control if list is empty var isDisabled = value.IsReadOnly.Or(items.Select(x => x.IsEmpty())); mountLocation.BindNativeProperty(dispatcher, "Enabled", isDisabled, isReadOnly => view.Enabled = !isReadOnly); mountLocation.BindNativeProperty(dispatcher, "items", items, tmpItems => { view.RemoveAllItems(); foreach (var i in tmpItems) { var tmp = i; view.Menu.AddItem(new NSMenuItem(i.ToString(), (s, a) => value.Write(tmp))); } }); return(view); }) .WithHeight(30); }
public void RemoveAllItems() { popup.RemoveAllItems(); }
public void ClearFilters() { fileTypes.RemoveAllItems(); }