简体   繁体   English

如何避免切换 <TabItem> 在 <TabControl>

[英]How to avoid switching <TabItem> in <TabControl>

I have a Form in which I have TabControl with few TabItems, but when I'm clicking on Tab, they are changing their position in TabControl. 我有一个带有少量TabItem的TabControl的窗体,但是当我单击Tab时,它们正在更改它们在TabControl中的位置。 How to avoid this kind of situation? 如何避免这种情况?

<TabControl>
    <TabItem Header="Header1" Name="Tab1">
            <Frame Background="White" Name="sig1" Source="tabs/signal1.xaml" />
    </TabItem>
    <TabItem Header="Header2" Name="Tab2">
            <Frame Background="White" Name="sig2" Source="tabs/signal2.xaml" />
    </TabItem>
</TabControl>   

This is my example of xaml code. 这是我的xaml代码示例。 I have much more tabs in TabControl property. 我在TabControl属性中有更多选项卡。 All the tabs from the same row shifts with the next ones tabs. 同一行中的所有选项卡都与下一个选项卡一起移动。

I guess when you have so many tabs then they are located in two/three rows. 我想您的标签页太多时,它们位于两行/三行中。 and when you click on a tab in the secound row then all of those tabs move to the first row. 当您点击第二行中的标签时,所有这些标签都移至第一行。 That is the normal behavior of TabControl. 这是TabControl的正常行为。 Have a look at this MSDN template for tabcontrol: https://msdn.microsoft.com/en-us/library/cc645035%28v=vs.95%29.aspx . 看看这个用于tabcontrol的MSDN模板: https : //msdn.microsoft.com/zh-cn/library/cc645035%28v=vs.95%29.aspx You can change the behavior in a template and use it in your project. 您可以在模板中更改行为,并在项目中使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM