private void CancelButton_Click(object sender, RoutedEventArgs e) { if (ItemSelected != null) { ItemSelected.Invoke(this, null); } }
/// <summary> /// Select an item from the list /// </summary> private void SelectItem(object param) { // Cast the parameter var newSelectedItemIndex = int.Parse(param.ToString()); // If the same item got selected there is no more to do if (mCurrentlySelectedItemIndex == newSelectedItemIndex) { return; } SelectionChanges.Invoke(); LastClickedItemIndex = newSelectedItemIndex; ItemSelected.Invoke(newSelectedItemIndex); if (!CanChangeSelection) { return; } // Unselect last item if there was any selected if (mCurrentlySelectedItemIndex != NothingSelected) { Items[mCurrentlySelectedItemIndex].IsSelected = false; } // Select the one that has been clicked Items[newSelectedItemIndex].IsSelected = true; // Save new selected item index mCurrentlySelectedItemIndex = newSelectedItemIndex; }
protected virtual void OnItemSelected(Item item) { if (ItemSelected != null) { ItemSelected.Invoke(this, item); } }
private async void HandleItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { var item = _adapter.GetItem(e.Position); if (item != _otherItem) { if (ItemSelected != null) { ItemSelected.Invoke(this, e); } } else { //binding will send this event, so we need to handle it and not displaying the popup string value = null; if (_fromUI) { value = await this.Services().Message.ShowPromptDialog(this.Services().Localize["OtherListItemLabel"], this.Services().Localize["OtherListItemPromptLabel"], () => { }, true); } if (OtherValueSelected != null) { OtherValueSelected(this, value); } } }
private void SelectItem(IItem item) { if (!_READY) { return; } if (item == null) { return; } // Supress the changes generated by ClearSelection. _SILENT = true; ClearSelection(); _SILENT = false; var e = FindElement(item); if (e != null) { e.IsSelected = true; _selectedItem = item; } else { // Item was not in the tree. if (_selectedItem != item) { _selectedItem = item; ItemSelected.Invoke(this, _selectedItem); } } }
public void InvokeItemSelected(int index) { if (ItemSelected != null) { ItemSelected.Invoke(this, index); } }
protected override void OnKeyDown(KeyEventArgs e) { if (e.KeyCode == Keys.Down) { SelectedIndex++; } if (e.KeyCode == Keys.Up) { SelectedIndex--; } if (e.KeyCode == Keys.PageUp) { SelectedIndex -= 6; } if (e.KeyCode == Keys.PageDown) { SelectedIndex += 6; } if (e.KeyCode == Keys.Enter) { var filteredItems = items.FindAll(Filter); int index = SelectedIndex; if (ItemSelected != null && index >= 0 && index < filteredItems.Count) { ItemSelected.Invoke(filteredItems[index], new EventArgs()); } } base.OnKeyDown(e); }
private void ItemSelect_ItemConfirmed(object sender, IItem item) { if (ItemSelected != null) { ItemSelected.Invoke(this, item); } }
/// <summary> /// Select an item from the list /// </summary> private void SelectItem(object param) { // Cast the parameter var newSelectedItemIndex = int.Parse(param.ToString()); // If the same item got selected there is no more to do if (mCurrentlySelectedItemIndex == newSelectedItemIndex) { return; } // Unselect last item if (mCurrentlySelectedItemIndex != NothingSelected) { Items[mCurrentlySelectedItemIndex].IsSelected = false; } // Select the one that has been clicked Items[newSelectedItemIndex].IsSelected = true; // Save new selected item index mCurrentlySelectedItemIndex = newSelectedItemIndex; // Indicate that there is an item selected IsAnySelected = true; // Set selected item SelectedItem = Items[newSelectedItemIndex].Test; // Fire the events SelectionChanged.Invoke(); ItemSelected.Invoke(SelectedItem); }
/// <summary> /// Selects an item from the list /// </summary> /// <param name="param">The index of the item</param> private void Select(object param) { // Cast the parameter var index = int.Parse(param.ToString()); // Select the item with that index SelectItem(index); ItemSelected.Invoke(ResultsList[index]); }
void InvokeItemsSelected(NSIndexPath[] indexPaths) { if (ItemSelected != null) { var item = ItemsForSelections(indexPaths); var args = new IUITableViewBindingProperties.ItemSelectedEventArgs(item); ItemSelected.Invoke(this, args); } }
protected override void OnAppearing() { base.OnAppearing(); if (Device.Idiom == TargetIdiom.Tablet || Device.Idiom == TargetIdiom.Desktop) { ItemSelected.Invoke(SelectedRowItem); } }
private void item_ItemClicked(object sender, EventArgs e) { UnselectAll(); ((TpItem)sender).Selected = true; if (ItemSelected != null) { ItemSelected.Invoke(sender, e); } Invalidate(); }
protected void cmdItemUse_Click(object sender, EventArgs e) { // When the user clicks to select an item.... string itemName = GetItemSelectedFromList(); // Check if someone is interested in this item selection if (ItemSelected != null) { ItemSelected.Invoke(itemName); } }
private void LoadItem() { Item item = _listView.SelectedItem as Item; if (item != null) { if (ItemSelected != null) { ItemSelected.Invoke(this, item); } } }
/// <summary> /// Selects an item from the list /// </summary> /// <param name="obj"></param> private void SelectItem(object obj) { var newSelectedIndex = (int)obj; if (ShouldSelectIndicatorBeVisible) { Items[mCurrentlySelectedIndex].IsSelected = false; Items[newSelectedIndex].IsSelected = true; } mCurrentlySelectedIndex = newSelectedIndex; ItemSelected.Invoke(Items[newSelectedIndex].Grading); }
/// <summary> /// Handler for ItemSelected event. /// </summary> /// <param name="control">Event source: <see cref="CollapsibleList"/>.</param> protected virtual void OnCategorySelected(Base control) { CollapsibleCategory cat = control as CollapsibleCategory; if (cat == null) { return; } if (ItemSelected != null) { ItemSelected.Invoke(this); } }
/// <summary> /// Handler for ItemSelected event. /// </summary> /// <param name="control">Event source: <see cref="CollapsibleList"/>.</param> protected virtual void OnCategorySelected(Base control, EventArgs args) { CollapsibleCategory cat = control as CollapsibleCategory; if (cat == null) { return; } if (ItemSelected != null) { ItemSelected.Invoke(this, new ItemSelectedEventArgs(cat)); } }
public MasterPage() { this.SetBinding(TitleProperty, "Title"); var list = new ListView(); list.HasUnevenRows = true; list.SetBinding(ListView.ItemsSourceProperty, "List"); list.ItemTemplate = new DataTemplate(typeof(ColorViewCell)); list.ItemSelected += (sender, args) => { if (list.SelectedItem == null) { return; } var detail = args.SelectedItem; if (Device.Idiom == TargetIdiom.Tablet || Device.Idiom == TargetIdiom.Desktop) { if (detail is IListContnent) { SelectedRowItem = detail as IListContnent; } ItemSelected.Invoke(detail); } else if (detail is ServerStatus) { var serverDetail = detail as ServerStatus; SelectedRowItem = serverDetail; list.SelectedItem = null; Navigation.PushAsync(new DetailView { BindingContext = serverDetail }); } else if (detail is Setting) { var settingDetail = detail as Setting; SelectedRowItem = settingDetail; list.SelectedItem = null; Navigation.PushAsync(new SettingsNotificationPage() { BackgroundColor = Color.Gray }); } }; Content = list; }
private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (null != comboBox.SelectedItem) { insertText = true; ComboBoxItem cbItem = (ComboBoxItem)comboBox.SelectedItem; SelectedItem = ((ComboBoxItem)comboBox.SelectedItem).Content.ToString(); textBox.Text = cbItem.Content.ToString(); //invoke event if (ItemSelected != null) { ItemSelected.Invoke(null, null); } } }
private void CategoryTree_Selected(object sender, System.Windows.RoutedPropertyChangedEventArgs <object> e) { if (!_READY) { return; } if (_SILENT) { return; } var oldE = (ItemTreeElement)e.OldValue; var newE = (ItemTreeElement)e.NewValue; if (RawItemSelected != null) { RawItemSelected.Invoke(null, newE == null ? null : newE.Item); } if (newE != null && _selectedItem == null && newE.Item == null) { // If both actual underlying items were null // we didn't really change anything. return; } // Don't allow null selections to escape this controller. if (newE == null || newE.Item == null) { return; } // If we re-selected the same item, selection doesn't escape this controller (didn't actually change). if (_selectedItem == newE.Item) { return; } _selectedItem = newE.Item; if (ItemSelected != null) { ItemSelected.Invoke(this, _selectedItem); } }
async void OnItemSelected(object sender, SelectedItemChangedEventArgs args) { var item = args.SelectedItem as StationViewModel; if (item == null) { return; } if (ItemSelected == null) { var DetailPage = new StationDetailPage(new StationDetailViewModel(item)); await Navigation.PushAsync(DetailPage); StationsListView.SelectedItem = null; } else { ItemSelected.Invoke(new StationDetailPage(new StationDetailViewModel(item))); } }
/// <summary> /// Internal handler for item selected event. /// </summary> /// <param name="control">Event source.</param> protected virtual void OnItemSelected(Base control) { //Convert selected to a menu item MenuItem item = control as MenuItem; if (null == item) { return; } m_SelectedItem = item; Text = m_SelectedItem.Text; m_Menu.IsHidden = true; if (ItemSelected != null) { ItemSelected.Invoke(this); } Focus(); Invalidate(); }
/// <summary> /// Internal handler for item selected event. /// </summary> /// <param name="control">Event source.</param> protected virtual void OnItemSelected(ControlBase control, EventArgs args) { if (!IsDisabled) { //Convert selected to a menu item MenuItem item = control as MenuItem; if (null == item) { return; } m_SelectedItem = item; m_Menu.IsCollapsed = true; if (ItemSelected != null) { ItemSelected.Invoke(this, new ItemSelectedEventArgs(item)); } Focus(); } }
/// <summary> /// Internal handler for item selected event. /// </summary> /// <param name="control">Event source.</param> protected virtual void OnItemSelected(ControlBase control, ItemSelectedEventArgs args) { if (!IsDisabled) { //Convert selected to a menu item MenuItem item = args.SelectedItem as MenuItem; if (null == item) { return; } m_SelectedItem = item; Text = m_SelectedItem.Text; m_Menu.IsHidden = true; if (ItemSelected != null) { ItemSelected.Invoke(this, args); } Focus(); Invalidate(); } }
public TabPage() { var tabs = MainDataRepo.GetTabLists(); foreach (var tab in tabs) { var masterPage = new MasterPage(); masterPage.BindingContext = tab; var navigationPage = new NavigationPage(masterPage) { Title = tab.Title, BarBackgroundColor = new Color().AppMainColor(), BarTextColor = Color.White }; Children.Add(navigationPage); } foreach (var childTab in Children) { var masterPage = ((NavigationPage)childTab).CurrentPage; ((MasterPage)masterPage).ItemSelected = (detail) => { ItemSelected.Invoke(detail); }; } }
public MenuEntity() : base() { KeyEventReceived += (sender, info) => { if (info.Key == ConsoleKey.DownArrow) { _selectedItem = (_selectedItem + 1) % _items.Count; Draw(); } else if (info.Key == ConsoleKey.UpArrow) { _selectedItem = _selectedItem - 1; if (_selectedItem < 0) { _selectedItem = _items.Count - 1; } Draw(); } else if (info.Key == ConsoleKey.Enter) { ItemSelected.Invoke(this, _items[_selectedItem]); } }; }
public void InvokeItemSelected() { ItemSelected.Invoke(item.FilePath); }
internal static void OnItemSelected(IHittable hittable) { ItemSelected?.Invoke(hittable, EventArgs.Empty); }
internal void SendItemSelected() { ItemSelected?.Invoke(this, EventArgs.Empty); }