【问题标题】:UWP TabView change tab programaticallyUWP TabView 以编程方式更改选项卡
【发布时间】:2021-12-08 03:42:12
【问题描述】:

如何以编程方式更改 TabView 的选项卡?例如,用户打开了第二个标签,我想将标签更改为第一个。

【问题讨论】:

    标签: c++ uwp tabview


    【解决方案1】:

    在 C++ 中,你必须这样做:

    int index = 1;
    if (tabcontrol->TabItems->Size > index)
    {
        tabcontrol->SelectedIndex = index;
    }
    

    【讨论】:

      【解决方案2】:

      根据this note

      您可以通过以下方式做到这一点:

      // Only select the tab if it is in the list
      if (tabToSelect < TabRoot.TabItems.Count)
      {
          TabRoot.SelectedIndex = tabToSelect;
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-06-12
        • 2015-06-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-21
        相关资源
        最近更新 更多