public static void AddEvent(BarBaseButtonItem control, ItemClickEventHandler eventhandler) { Delegate delegateList = eventHandlerList[control.Name]; if (delegateList != null) { foreach (Delegate d in delegateList.GetInvocationList()) control.ItemClick -= (ItemClickEventHandler)d; eventHandlerList.RemoveHandler(control.Name, delegateList); } control.ItemClick += eventhandler; eventHandlerList.AddHandler(control.Name, eventhandler); }
private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var listView = (ListViewBase)d; if (listView == null) { return; } if (!listView.IsItemClickEnabled) { Debug.WriteLine("ItemClick should be enabled in order to use the command"); Debugger.Break(); } ClearPreviousEvents(listView); if (e.NewValue == null) { return; } var eventHandler = new ItemClickEventHandler(ListViewBase_ItemClick); _eventHandlers.Add(listView, eventHandler); listView.ItemClick += eventHandler; }
public static BarButtonItem GetRefreshButton(ItemClickEventHandler handler) { var button = GetRefreshButton(); button.ItemClick += handler; return button; }
public static BarButtonItem GetCustomButton(string caption, System.Drawing.Image glyph, ItemClickEventHandler handler) { var button = GetCustomButton(caption, glyph); button.ItemClick += handler; return button; }
public IAsyncOperation <ContentDialogBaseResult> ShowAsync(TLMessagesStickerSet parameter, ItemClickEventHandler callback) { ViewModel.IsLoading = false; ViewModel.StickerSet = parameter.Set; ViewModel.Items.Clear(); ViewModel.Items.Add(parameter); return(ShowAsync()); }
// public void CSV(ItemClickEventHandler handle) { BtnCSV.ItemClick += handle; }
//PRINT public void Print(ItemClickEventHandler handle) { BtnPrint.ItemClick += handle; }
// SAVE public void Save(ItemClickEventHandler handle) { BtnSave.ItemClick += handle; }
//DELETE public void Delete(ItemClickEventHandler handle) { BtnDelete.ItemClick += handle; }
public IAsyncOperation <ContentDialogBaseResult> ShowAsync(StickerSet parameter, ItemClickEventHandler callback) { return(ShowAsync(parameter.Id, callback)); }
/// <summary> /// Insert BarItem into bar. /// </summary> /// <typeparam name="T">Type of BarItem.</typeparam> /// <param name="bar">Bar</param> /// <param name="index">Index of BarItem.</param> /// <param name="caption">Caption of BarItem.</param> /// <param name="glyph">Glyph of BarItem.</param> /// <param name="key">Key of BarItem (ItemShortcut).</param> /// <param name="itemClick">ItemClick of BarItem.</param> /// <returns>Returns inserted BarItem</returns> public static T InsertBarItem <T>(this Bar bar, int index, string caption, Image glyph = null, Keys key = Keys.None, ItemClickEventHandler itemClick = null) where T : BarItem, new() { var item = new T { Caption = caption, Glyph = glyph }; if (key != Keys.None) { item.ItemShortcut = new BarShortcut(key); } if (bar.LinksPersistInfo.Count > 0 && bar.ItemLinks.Count == 0) { if (index > bar.LinksPersistInfo.Count) { index = bar.LinksPersistInfo.Count; } bar.LinksPersistInfo.Insert(index, new LinkPersistInfo(item)); } else if (bar.ItemLinks.Count > 0) { if (index > bar.ItemLinks.Count) { index = bar.ItemLinks.Count; } bar.InsertItem(bar.ItemLinks[index], item); } else { bar.AddItem(item); } //bar.ItemLinks.Insert(index, item); if (itemClick != null) { item.ItemClick += itemClick; } return(item); }
/// <summary> /// Add BarItem into barSubItem. /// </summary> /// <typeparam name="T">Type of BarItem.</typeparam> /// <param name="barSubItem">Owner item</param> /// <param name="caption">Caption of BarItem.</param> /// <param name="glyph">Glyph of BarItem.</param> /// <param name="key">Key of BarItem (ItemShortcut).</param> /// <param name="itemClick">ItemClick of BarItem.</param> /// <returns>Returns added BarItem</returns> public static T AddBarItem <T>(this BarSubItem barSubItem, string caption, Image glyph, Keys key = Keys.None, ItemClickEventHandler itemClick = null) where T : BarItem, new() { var item = new T { Caption = caption, Glyph = glyph }; if (key != Keys.None) { item.ItemShortcut = new BarShortcut(key); } barSubItem.AddItem(item); if (itemClick != null) { item.ItemClick += itemClick; } return(item); }
/// <summary> /// Add AddBarCheckItem into bar. /// </summary> /// <typeparam name="T">Type of BarCheckItem.</typeparam> /// <param name="barSubItem">BarSubItem</param> /// <param name="caption">Caption of BarCheckItem.</param> /// <param name="glyph">Glyph of BarCheckItem.</param> /// <param name="key">Key of BarCheckItem (ItemShortcut).</param> /// <param name="checkedChanged">CheckedChanged of BarCheckItem.</param> /// <returns>Returns inserted BarItem</returns> public static T AddBarCheckItem <T>(this BarSubItem barSubItem, string caption, Image glyph = null, Keys key = Keys.None, ItemClickEventHandler checkedChanged = null) where T : BarCheckItem, new() { var item = AddBarItem <T>(barSubItem, caption, glyph, key); if (checkedChanged != null && item != null) { item.CheckedChanged += checkedChanged; } return(item); }
public static void CreateBusinessMenu(PivotGridControl gridMaster, BarSubItem barSubItem1, string fieldName, string[] captions, string[] ImageNames, DelegationLib.CallFunction_MulIn_NoOut[] delegates, PermissionItem[] pers) { ItemClickEventHandler handler = null; if (captions == null) { barSubItem1.Visibility = BarItemVisibility.Never; } else { int index = 0; foreach (string str in captions) { bool? nullable; if (((pers != null) && (pers[index] != null)) && !(ApplyPermissionAction.checkPermission(pers[index]).HasValue && !(!(nullable = ApplyPermissionAction.checkPermission(pers[index])).GetValueOrDefault() && nullable.HasValue))) { index++; } else { BarButtonItem item = new BarButtonItem(); item.Caption = captions[index]; item.Name=index.ToString(); if (!ImageNames[index].Equals("")) { item.Glyph=ResourceMan.getImage16(ImageNames[index]); } item.PaintStyle = BarItemPaintStyle.Standard; if (handler == null) { handler += new ItemClickEventHandler(delegate(object sender, ItemClickEventArgs e) { if (gridMaster.Cells.MultiSelection.SelectedCells.Count < 1) { HelpMsgBox.ShowNotificationMessage(""); } else { List<object> data = new List<object>(); foreach (Point point in gridMaster.Cells.MultiSelection.SelectedCells) { data.Add(point); } delegates[HelpNumber.ParseInt32(e.Item.Name)](data); } }); } item.ItemClick += handler; barSubItem1.ItemLinks.Add(item); index++; } } if ((barSubItem1.ItemLinks == null) || (barSubItem1.ItemLinks.Count == 0)) { barSubItem1.Visibility = BarItemVisibility.Never; } } }
public IAsyncOperation <ContentDialogBaseResult> ShowAsync(TLInputStickerSetBase parameter, ItemClickEventHandler callback) { ViewModel.IsLoading = true; ViewModel.StickerSet = new TLStickerSet(); ViewModel.Items.Clear(); RoutedEventHandler handler = null; handler = new RoutedEventHandler(async(s, args) => { Loaded -= handler; ItemClick = callback; await ViewModel.OnNavigatedToAsync(parameter, NavigationMode.New, null); }); Loaded += handler; return(ShowAsync()); }
public Task <ContentDialogResult> ShowAsync(StickerSet parameter, ItemClickEventHandler callback) { return(ShowAsync(parameter.Id, callback)); }
//ADD - NEW public void Add(ItemClickEventHandler handle) { BtnAdd.ItemClick += handle; }
/// <summary> /// Configures the Landscape with a click event delegate, styles, and sizes. Must be called before it can be used. /// </summary> /// <param name="ClickHandler">An ItemClickEventHandler delegate which is called when any item in the GridView is clicked.</param> /// <param name="TileStyle">The styling for each tile in the Grid View.</param> /// <param name="ItemTemplate">The XAML describing what controls are in each tile in the Grid View.</param> /// <param name="ClickHandlerSnapped">An ItemClickEventHandler delegate which is called when any item in the ListView is clicked while snapped. This is normally the same as the ClickHandler parameter.</param> /// <param name="TileStyleSnapped">The styling for each tile in the List View when snapped. Pass null if ListView isn't supported.</param> /// <param name="ItemTemplateSnapped">The XAML describing what controls are in each tile in the List View when snapped. Pass null if ListView isn't supported.</param> /// <param name="height">The available height in the Grid row hosting the Landscape control.</param> /// <param name="startingState">The starting view state (snapped or filled) for proper visual set up.</param> /// <param name="IsItemClickEnabled">Determines whether the Grid View items themselves can be clicked - use false if they are carrying controls.</param> public void Configure(ItemClickEventHandler ClickHandler, Style TileStyle, DataTemplate ItemTemplate, ItemClickEventHandler ClickHandlerSnapped, Style TileStyleSnapped, DataTemplate ItemTemplateSnapped, double height, bool IsItemClickEnabled) { if (ClickHandler != null) { this.LandscapeContent.ItemClick += ClickHandler; } this.LandscapeContent.ItemTemplate = ItemTemplate; this.LandscapeContent.IsItemClickEnabled = IsItemClickEnabled; this.LandscapeContentSnapped.IsItemClickEnabled = IsItemClickEnabled; adjustedHeight = 450; //hard coded for now //if (adjustedHeight > MAX_ITEM_HEIGHT) // adjustedHeight = MAX_ITEM_HEIGHT; try //If the setter is already added, then there will be an error if you're trying to add it again { TileStyle.Setters.Add(new Setter(GridViewItem.HeightProperty, adjustedHeight)); TileStyle.Setters.Add(new Setter(GridViewItem.WidthProperty, adjustedHeight)); } catch { } this.LandscapeContent.ItemContainerStyle = TileStyle; if (ClickHandlerSnapped != null) { this.LandscapeContentSnapped.ItemClick += ClickHandlerSnapped; } this.LandscapeContentSnapped.ItemTemplate = ItemTemplateSnapped; this.LandscapeContentSnapped.ItemContainerStyle = TileStyleSnapped; //This also sets the built-in view state, which is used for proper scrolling ChangeViewState(); configured = true; }
//EDIT public void Edit(ItemClickEventHandler handle) { BtnEdit.ItemClick += handle; }
/// <summary> /// 添加按钮 /// </summary> /// <param name="btn">按钮对象</param> /// <param name="Authority">权限,默认0</param> /// <param name="DoClick">事件绑定</param> protected void AddButton(RibbonItemButtonBase btn, int Authority, ItemClickEventHandler DoClick) { var bi = AddButton(btn, Authority, ""); bi.ItemClick += DoClick; }
//REPORT public void Report(ItemClickEventHandler handle) { BtnReport.ItemClick += handle; }
protected void InsertAfterButton(string ReferButtonName, RibbonItemButtonBase btn, int Authority, string AuthorityName, ItemClickEventHandler DoClick) { var bi = InsertButton(ReferButtonName, false, btn, Authority, AuthorityName); bi.ItemClick += DoClick; }
//EXCEL public void Excel(ItemClickEventHandler handle) { BtnExcel.ItemClick += handle; }
public ControlPanelItem AddItem(int icon, string caption, string toolTip, string tag, ItemClickEventHandler onClickEvent) { ControlPanelItem item = new ControlPanelItem(this, tag, icon, caption, toolTip); m_ItemsDictionary.Add(tag, item); item.ItemClickEvent += onClickEvent; return item; }
public bool AddButtonItem(string pageName, string groupName, string itemName, Image itemImage, ItemClickEventHandler callBack, ref string restr) { DevExpress.XtraBars.Ribbon.RibbonPage page = this.ribbon_Title.Pages.GetPageByName(pageName); if (page == null) { restr = "不存在[" + page + "]标题页!"; return(false); } DevExpress.XtraBars.Ribbon.RibbonPageGroup group = page.Groups.GetGroupByName(groupName); if (group == null) { restr = "不存在[" + groupName + "]组!"; return(false); } DevExpress.XtraBars.BarButtonItem buttonItem = new BarButtonItem(); buttonItem.Name = itemName; buttonItem.Caption = itemName; buttonItem.ImageOptions.LargeImage = itemImage; buttonItem.ItemClick += callBack; group.ItemLinks.Add(buttonItem); restr = "添加菜单项成功!"; return(true); }
//VIEW public void View(ItemClickEventHandler handle) { BtnView.ItemClick += handle; }
public IAsyncOperation <ContentDialogBaseResult> ShowAsync(TLStickerSet parameter, ItemClickEventHandler callback) { return(ShowAsync(new TLInputStickerSetID { Id = parameter.Id, AccessHash = parameter.AccessHash }, callback)); }
//CLOSE public void Close(ItemClickEventHandler handle) { BtnClose.ItemClick += handle; }
public static BarButtonItem GetPrintButton(string caption, ItemClickEventHandler handler) { var button = GetPrintButton(caption); button.ItemClick += handler; return button; }
//FORWARD public void Forward(ItemClickEventHandler handle) { BtnFrd.ItemClick += handle; }
/// <summary> /// Adds the bar item. /// </summary> /// <param name="caption">The caption.</param> /// <param name="glyph">The glyph.</param> /// <param name="largeGlyph">The large glyph.</param> /// <param name="itemClickEventHandler">The item click event handler.</param> /// <param name="beginGroup">if set to <c>true</c> [begin group].</param> /// <returns></returns> private BarButtonItem AddBarItem(string caption, Image glyph, Image largeGlyph, ItemClickEventHandler itemClickEventHandler, bool beginGroup) { BarButtonItem item = new BarButtonItem(Manager, caption); item.Glyph = glyph; item.LargeGlyph = largeGlyph; item.ItemClick += itemClickEventHandler; BarItemLink link = AddItem(item); link.BeginGroup = beginGroup; return item; }
//PREVERSE public void Preverse(ItemClickEventHandler handle) { BtnPrv.ItemClick += handle; }