我正在WPF中創建一個應用程序。ScrollDown在溢出情況下的ContextMenu
// Create WinForm notify icon
m_NotifyIcon = new System.Windows.Forms.NotifyIcon();
m_NotifyIcon.Icon = Properties.Resources.rocket;
m_NotifyIcon.Visible = true;
// Default Balloon title
m_NotifyIcon.BalloonTipTitle = "Greatest App ever";
m_NotifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu();
// Append default menu items
List<MenuItem> itemList = new List<MenuItem>();
itemList.Insert(0, new MenuItem("Exit", OnExit_Click));
itemList.Insert(0, new MenuItem("-"));
itemList.Insert(0, new MenuItem("Refresh", RefreshConsoleList));
itemList.Insert(0, new MenuItem("Filter: \"" + (String.IsNullOrEmpty(m_Filter) ? "NONE" : m_Filter) + "\"", ChangeFilter_Click));
itemList.Insert(0, new MenuItem("-"));
m_NotifyIcon.ContextMenu.MenuItems.AddRange(itemList.ToArray());
的結果看起來是這樣的:
我使用 「System.Windows.Forms.NotifyIcon」
代碼看起來像包括了托盤圖標在刷新的情況下,我的應用程序將獲得大量條目,然後將這些條目附加到ContextMenu中,菜單將如下所示:
正如你所看到的,有太多的菜單項,並因爲溢出,2個箭頭將顯示(頂部和文本菜單的底部)
現在,如果用戶想退出應用程序,他必須向下滾動,然後單擊退出。 如果列表非常大,可能會惹惱用戶。
爲了避免這種情況,我想顯示的文本菜單已滾動至底部時,它彈出(第一個菜單項是可見的)
但我沒有發現任何事件或控制使用向下滾動編程ContextMenu。
可以嗎?
問候
伊夫Desgraupes
PS:我無法直接發佈,因爲我的名聲的圖像(這是我的第一篇文章),然後發佈超過2個鏈接。
第三爲例是在這裏:
yves.desgraupes.free.fr/shared/ContextMenu_OverflowScroll.png
爲什麼不使用嵌套菜單? –
嵌套菜單是一個好主意,但我真的需要用戶直接訪問列表 –