Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 子用户控件中的WPF选项卡导航_C#_Wpf_Xaml - Fatal编程技术网

C# 子用户控件中的WPF选项卡导航

C# 子用户控件中的WPF选项卡导航,c#,wpf,xaml,C#,Wpf,Xaml,我试图控制我的标签导航。我做了一个小程序来测试它,但我没有得到我想要的 我想按一定的顺序结账。其中一个选项卡的焦点是用户控件。一旦进入用户控件,我想按另一个顺序进行制表。然后当所有的userControl选项卡都完成后,返回到我的主控件 因为我的代码很短,所以我会全部粘贴 首先是我的主窗口 <Window x:Class="WpfApp1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/pres

我试图控制我的标签导航。我做了一个小程序来测试它,但我没有得到我想要的

我想按一定的顺序结账。其中一个选项卡的焦点是用户控件。一旦进入用户控件,我想按另一个顺序进行制表。然后当所有的userControl选项卡都完成后,返回到我的主控件

因为我的代码很短,所以我会全部粘贴

首先是我的主窗口

<Window x:Class="WpfApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <StackPanel KeyboardNavigation.TabNavigation="Local">
        <TextBox Text="0" KeyboardNavigation.TabIndex="0" />
        <TextBox Text="5" KeyboardNavigation.TabIndex="5" />
        <local:Page1 KeyboardNavigation.TabIndex="3"/>
        <TextBox Text="4" KeyboardNavigation.TabIndex="4" />
        <TextBox Text="1" KeyboardNavigation.TabIndex="1" />
        <TextBox Text="2" KeyboardNavigation.TabIndex="1" />
    </StackPanel>

</Window>

然后,页面1使用TabIndex=“3”可以看到谁是用户控件


当我的标签是

0 1 2 4 5儿童0儿童1儿童2儿童3

我想要的是

0 1 2儿童0儿童1儿童2儿童3 4 5


无论如何,要实现这一点?我尝试将选项卡导航更改为本地容器等。。。并且没有找到使其工作的方法。

用户控件中删除
键盘导航。TabNavigation=“Contained”
,然后尝试以下操作:

<StackPanel>
    <TextBox Text="0" KeyboardNavigation.TabIndex="0" />
    <TextBox Text="5" KeyboardNavigation.TabIndex="5" />
    <local:Page1 KeyboardNavigation.TabIndex="3" KeyboardNavigation.TabNavigation="Local"/>
    <TextBox Text="4" KeyboardNavigation.TabIndex="4" />
    <TextBox Text="1" KeyboardNavigation.TabIndex="1" />
    <TextBox Text="2" KeyboardNavigation.TabIndex="2" />
</StackPanel>

UserControl
中删除
KeyboardNavigation.TabNavigation=“Contained”
,然后尝试以下操作:

<StackPanel>
    <TextBox Text="0" KeyboardNavigation.TabIndex="0" />
    <TextBox Text="5" KeyboardNavigation.TabIndex="5" />
    <local:Page1 KeyboardNavigation.TabIndex="3" KeyboardNavigation.TabNavigation="Local"/>
    <TextBox Text="4" KeyboardNavigation.TabIndex="4" />
    <TextBox Text="1" KeyboardNavigation.TabIndex="1" />
    <TextBox Text="2" KeyboardNavigation.TabIndex="2" />
</StackPanel>


Perfect正是我需要的我只是不太懂如何使用TabNavigation完美正是我需要的我只是不太懂如何使用TabNavigation