public MultiCollection() { this.RegisterMethodParam(nameof(OnItemSelected), nameof(ItemSelected)); var leftStack = new StackLayout { Spacing = 0 }; var rightStack = new StackLayout { Spacing = 0 }; SetColumn(leftStack, 0); SetColumn(rightStack, 1); ColumnSpacing = 0; void OnItemsSourceChanged() { int temp = 0; if (PromotionItemTemplate is not null) { var itemPromotion = (View)PromotionItemTemplate.CreateContent(); rightStack.Children.Clear(); leftStack.Children.Clear(); Children.Clear(); Children.Add(leftStack); Children.Add(rightStack); rightStack.Children.Add(itemPromotion); itemPromotion.OnTapped(() => { ItemPromotionSelected?.Invoke(null); }); } ItemsSource.Cast <object>()?.ForEach(item => { var itemView = (View)ItemTemplate .Assert("ItemTemplate is null.") .CreateContent(); itemView.BindingContext = item; var isEven = temp++ % 2 == 0; if (isEven) { leftStack.Children.Add(itemView); } else { rightStack.Children.Add(itemView); } (itemView as FrameRipple).Tap = () => { ItemSelected?.Invoke(item); }; }); } this.OnChanged(_ => _.ItemsSource, OnItemsSourceChanged); }
internal static void OnItemSelected(IHittable hittable) { ItemSelected?.Invoke(hittable, EventArgs.Empty); }
public MConfirmationDialog(EvasObject parent) : base(parent) { Style = Styles.Popup.Confirmation; _layout = new Box(parent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, }; _layout.Show(); _genList = new GenList(parent) { WeightX = 1, WeightY = 1, AlignmentY = -1, AlignmentX = -1, SelectionMode = GenItemSelectionMode.Always }; _itemClass = new GenItemClass(Styles.GenListItem.Default) { GetContentHandler = GetContent, GetTextHandler = GetText }; _genList.ItemSelected += (s, e) => { var item = e.Item.Data as MConfirmationDialogItem; if (item.CheckBox is Radio r) { r.GroupValue = item.Id; } else if (item.CheckBox is Check c) { c.IsChecked = !c.IsChecked; } _confirmButton.IsEnabled = (_itemList.Where(kv => kv.Value.IsSelected).Count() > 0); }; OutsideClicked += (s, e) => { Dismiss(); }; _genList.Show(); _layout.PackEnd(_genList); _confirmButton = new MPopupButton(this); _confirmButton.IsEnabled = false; _confirmButton.Clicked += (s, e) => { Dismiss(); var selected = _itemList.Where(kv => kv.Value.IsSelected).Select(kv => kv.Value); ItemSelected?.Invoke(this, new MConfirmationDialogItemSelectedArgs(selected)); }; _cancelButton = new MPopupButton(this); _cancelButton.Clicked += (s, e) => { Dismiss(); }; SetPartContent(Parts.Popup.Button2, _confirmButton); SetPartContent(Parts.Popup.Button1, _cancelButton); SetContent(_layout); }
public void Handle(ItemSelected <FeatureDefinition> message) { SelectedFeatureDefinition = message.Item; SetActivatedFeature(); }
/// <summary> /// Called when the <see cref="ItemSelected"/> event is raised. /// </summary> protected virtual void OnItemSelected(ComboBox sender) => ItemSelected?.Invoke(sender);
public void InvokeItemSelected() { ItemSelected.Invoke(item.FilePath); }
protected virtual void OnItemSelected(string[] param) { ItemSelected?.Invoke(param, EventArgs.Empty); }
private void ItemClicked(TableView sender, GenericItem itemListItem) { ItemSelected?.Invoke(itemListItem.item); }
protected virtual void OnItemSelected(BreadcrumbEventArgs e) { ItemSelected?.Invoke(this, e); }
public MenuItem(String Text, ItemSelected function) : base(Text, Load.FontMenu, Load.ColorTextMenu) { LaunchSelection = function; }
protected void SelectItem() { IsSelected = !IsSelected; ItemSelected?.Invoke(this, EventArgs.Empty); }
public void FireItemSelectedEvent(EventArgs e) { ItemSelected?.Invoke(this, e); }
void InitializeSmartEvent() { _selected = new SmartEvent <GenGridItemEventArgs>(this, this.RealHandle, "selected", GenGridItemEventArgs.CreateFromSmartEvent); _unselected = new SmartEvent <GenGridItemEventArgs>(this, this.RealHandle, "unselected", GenGridItemEventArgs.CreateFromSmartEvent); _activated = new SmartEvent <GenGridItemEventArgs>(this, this.RealHandle, "activated", GenGridItemEventArgs.CreateFromSmartEvent); _pressed = new SmartEvent <GenGridItemEventArgs>(this, this.RealHandle, "pressed", GenGridItemEventArgs.CreateFromSmartEvent); _released = new SmartEvent <GenGridItemEventArgs>(this, this.RealHandle, "released", GenGridItemEventArgs.CreateFromSmartEvent); _doubleClicked = new SmartEvent <GenGridItemEventArgs>(this, this.RealHandle, "clicked,double", GenGridItemEventArgs.CreateFromSmartEvent); _realized = new SmartEvent <GenGridItemEventArgs>(this, this.RealHandle, "realized", GenGridItemEventArgs.CreateFromSmartEvent); _unrealized = new SmartEvent <GenGridItemEventArgs>(this, this.RealHandle, "unrealized", GenGridItemEventArgs.CreateFromSmartEvent); _longpressed = new SmartEvent <GenGridItemEventArgs>(this, this.RealHandle, "longpressed", GenGridItemEventArgs.CreateFromSmartEvent); _focused = new SmartEvent <GenGridItemEventArgs>(this, this.RealHandle, "item,focused", GenGridItemEventArgs.CreateFromSmartEvent); _unfocused = new SmartEvent <GenGridItemEventArgs>(this, this.RealHandle, "item,unfocused", GenGridItemEventArgs.CreateFromSmartEvent); _changed = new SmartEvent(this, this.RealHandle, "changed"); _selected.On += (s, e) => { if (e.Item != null) { ItemSelected?.Invoke(this, e); } }; _unselected.On += (s, e) => { if (e.Item != null) { ItemUnselected?.Invoke(this, e); } }; _activated.On += (s, e) => { if (e.Item != null) { ItemActivated?.Invoke(this, e); } }; _pressed.On += (s, e) => { if (e.Item != null) { ItemPressed?.Invoke(this, e); } }; _released.On += (s, e) => { if (e.Item != null) { ItemReleased?.Invoke(this, e); } }; _doubleClicked.On += (s, e) => { if (e.Item != null) { ItemDoubleClicked?.Invoke(this, e); } }; _realized.On += (s, e) => { if (e.Item != null) { ItemRealized?.Invoke(this, e); } }; _unrealized.On += (s, e) => { if (e.Item != null) { ItemUnrealized?.Invoke(this, e); } }; _longpressed.On += (s, e) => { if (e.Item != null) { ItemLongPressed?.Invoke(this, e); } }; _focused.On += (s, e) => { if (e.Item != null) { ItemFocused?.Invoke(this, e); } }; _unfocused.On += (s, e) => { if (e.Item != null) { ItemUnfocused?.Invoke(this, e); } }; _changed.On += (s, e) => { Changed?.Invoke(this, e); }; }
private void GoToUser(UserItemViewModel item) { ItemSelected.ExecuteNow(item); }
private void AddCell(ListElement item, int x, int y) { StackLayout sl = new StackLayout() { HorizontalOptions = LayoutOptions.Center, Spacing = 0 }; if (!string.IsNullOrWhiteSpace(item.Image)) { if (item.Image.Contains(".svg")) { SvgCachedImage img = new SvgCachedImage() { Source = item.Image, Aspect = Aspect.AspectFit, WidthRequest = App.Current.MainPage.Width / Columns, InputTransparent = true }; if (ImageWidth > 0) { img.WidthRequest = ImageWidth; } sl.Children.Add(img); } else { CachedImage img = new CachedImage() { Source = item.Image, Aspect = Aspect.AspectFit, WidthRequest = Application.Current.MainPage.Width / Columns, InputTransparent = true }; if (ImageWidth > 0) { img.WidthRequest = ImageWidth; } sl.Children.Add(img); } } else { IconLabel icon = new IconLabel() { Text = item.Icon, HorizontalOptions = LayoutOptions.Center, FontSize = item.IconFontSize, InputTransparent = true, TextColor = item.IconTextColor }; sl.Children.Add(icon); } Label title = new Label() { Text = item.Title, HorizontalOptions = LayoutOptions.Center, FontSize = item.FontSize, HorizontalTextAlignment = TextAlignment.Center, FontAttributes = FontAttributes.Bold, InputTransparent = true, TextColor = item.TextColor }; sl.Children.Add(title); if (!string.IsNullOrWhiteSpace(item.Description)) { Label description = new Label() { Margin = new Thickness(0, -2, 0, 2), Text = item.Description, HorizontalOptions = LayoutOptions.Center, FontSize = item.FontSize, HorizontalTextAlignment = TextAlignment.Center, InputTransparent = true, TextColor = item.TextColor }; sl.Children.Add(description); } TapGestureRecognizer tgr = new TapGestureRecognizer() { NumberOfTapsRequired = 1 }; tgr.Tapped += (s, ee) => { SelectedItem = item; ItemSelected?.Invoke(sl, new SelectedItemChangedEventArgs(item)); }; sl.GestureRecognizers.Add(tgr); gGrid.Children.Add(sl, x, y); }
protected virtual void OnItemSelected(ItemEventArgs e) { ItemSelected?.Invoke(this, e); }
public virtual void SendItemSelected(int index) { ItemSelected?.Invoke(this, new SelectedItemChangedEventArgs(this[index], index)); }
public void OnItemSelected() { ItemSelected?.Invoke(this, EventArgs.Empty); }
protected virtual void OnItemSelected(T_SQD obj) { SelectedSqd = obj; ItemSelected?.Invoke(obj); Close(); }
private void HandleSelectionUpdates() { if (m_selectionContext == null) { return; } object hitItem = LastHit; if ((hitItem == null) || (hitItem == this)) { return; } TreeListView.Node hitNode; if (!m_dictNodes.TryGetValue(hitItem, out hitNode)) { return; } HashSet <object> oldSelection = null; HashSet <object> newSelection = null; var handler = ItemSelected; if (handler != null) { oldSelection = new HashSet <object>(m_selectionContext.Selection); } switch (Control.ModifierKeys) { case Keys.Shift: { if (m_selectionStartItem != null) { int idx1 = m_treeListView.GetNodeIndex(m_selectionStartItem); int idx2 = m_treeListView.GetNodeIndex(hitNode); int startIndex = Math.Min(idx1, idx2); int endIndex = Math.Max(idx1, idx2); newSelection = new HashSet <object>(); for (int i = startIndex; i <= endIndex; i++) { TreeListView.Node item = m_treeListView.GetNodeAtIndex(i); newSelection.Add(item.Tag); } m_selectionContext.SetRange(newSelection); } else { m_selectionContext.Set(hitItem); m_selectionStartItem = hitNode; } } break; case Keys.Control: { if (m_selectionContext.SelectionContains(hitItem)) { m_selectionContext.Remove(hitItem); } else { m_selectionContext.Add(hitItem); } m_selectionStartItem = hitNode; } break; default: { m_selectionContext.Set(hitItem); m_selectionStartItem = hitNode; } break; } if (handler == null) { return; } if (newSelection == null) { newSelection = new HashSet <object>(m_selectionContext.Selection); } foreach (object removed in oldSelection.Except(newSelection)) { TreeListView.Node node; if (!m_dictNodes.TryGetValue(removed, out node)) { continue; } ItemSelected.Raise(this, new NodeAdapterEventArgs(removed, node)); } foreach (object added in newSelection.Except(oldSelection)) { TreeListView.Node node; if (!m_dictNodes.TryGetValue(added, out node)) { continue; } ItemSelected.Raise(this, new NodeAdapterEventArgs(added, node)); } }
internal void OnItemSelectedInternal(object sender, SelectedItemChangedEventArgs args) { SelectedItem = args.SelectedItem; ItemSelected?.Invoke(sender, args); OnItemSelected(args); }
protected virtual void OnItemSelected(Batch item) { ItemSelected?.Invoke(this, item); }
void addToCart() { ItemSelected?.Invoke(this, infoHolder); }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { var item = SearchController.ListProxy[indexPath.Row]; ItemSelected?.Invoke(this, item); }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { ItemSelected?.Invoke(this, new TableViewEventArgs(_keys.ElementAt(indexPath.Row))); }
public void Handle(ItemSelected <Location> message) { SelectedLocation = message.Item; SetActivatedFeature(); }
public void OnItemSelected() { ItemSelected?.Invoke(); }
protected virtual void OnItemSelected(DataRow obj) { SelectedRow = obj; ItemSelected?.Invoke(obj); Close(); }
private void Item_Click(object sender, EventArgs e) { ItemSelected?.Invoke(this, EventArgs.Empty); }
public void Handle([NotNull] ItemSelected <FeatureDefinition> message) { SelectedFeatureDefinition = message.Item; }
public void initialize(bool horizontal, string prefix, ItemSelected i) { this.drag_prefix = prefix; this.is_horizontal = horizontal; this.item_selected = i; if (is_horizontal) { drag_direction1 = new Point(0, 1); drag_direction2 = new Point(0, -1); _list = this._list_horizontal; _list_vertical.Visibility = System.Windows.Visibility.Collapsed; } else { drag_direction1 = new Point(1, 0); drag_direction2 = new Point(-1, 0); _list = _list_vertical; _list_horizontal.Visibility = System.Windows.Visibility.Collapsed; } populator = new list_populator(); populator.avatar_drag = this.avatar_drag; populator._list = this._list; if (!configurations.use_avatar_drag) { this._list.PreviewTouchDown += new EventHandler<TouchEventArgs>(_list_PreviewTouchDown); this._list.PreviewTouchMove += new EventHandler<TouchEventArgs>(_list_PreviewTouchMove); this._list.PreviewTouchUp += new EventHandler<TouchEventArgs>(_list_PreviewTouchUp); //this._list.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(_list_PreviewMouseLeftButtonDown); } if (configurations.high_contrast) this._list.Background = Brushes.DarkGreen; else this._list.Background = Brushes.Transparent; //if (configurations.response_to_mouse_clicks) this._list.SelectionChanged += new SelectionChangedEventHandler(_list_SelectionChanged); }