如何将一个标签导航到其他标签? [英] how to navigate one tab to other tab ?

查看:106
本文介绍了如何将一个标签导航到其他标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WPF中有多个标签项,在功能区栏中有两个按钮'NEXT''PREVIOUS'。



我的问题是,怎么做单击功能区栏中的按钮导航选项卡...

I have tab in WPF which has many tab items, in ribbon bar there is two button 'NEXT''PREVIOUS'.

My question is, how do I navigate tabs when clicking on the button in ribbon bar...

推荐答案

您可以为下一个和上一个点击事件增加/减少tabcontrol.selectedIndex

类似

You can increment/decrement tabcontrol.selectedIndex for next and previous click events
something like
tabcontrol.selectedIndex = tabcontrol.selectedIndex+1; (for  next button click event)
tabcontrol.selectedIndex = tabcontrol.selectedIndex -1; (for previous button click event)


TabControl具有SelectedItem属性,可用于获取或设置当前选定的TabItem。因此,您可以使用int字段来跟踪当前选定的选项卡,并在Next按钮的事件处理程序中,只需将int字段增加1并将SelectedTab属性设置为相应的索引



The TabControl has a SelectedItem property which can be used to get or set the currently selected TabItem. Thus, you can use an int field to keep track of the currently selected tab, and in the Next button's event handler, just increase the int field by one and set the SelectedTab property to the corresponding index

currentIndex += 1;
myTabControl.SelectedTab = myTabControl.Items[currentIndex];





对于Previous按钮反之亦然。



希望这有助于



And vice versa for the Previous button.

Hope this helps


这篇关于如何将一个标签导航到其他标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆