1
我有一個WPF窗口/窗體與各種控件。WPF Tabindexes行爲不如預期 - 力量很弱
我已經設置了tabindexes在所需的順序,但我越來越奇怪的行爲。
當通過窗口切換時,順序應該如下:左邊的第一個文本框,然後右邊的日期控件,然後我的選項卡控件和標籤頁,然後只有按鈕。
但是選項卡控件正在跳過,焦點直接移動到按鈕。如果我繼續按鈕後選擇標籤控件。
下面是xmal。
任何幫助表示讚賞。
<Window xmlns:my="clr-namespace:DevExpress.Xpf.Editors;assembly=DevExpress.Xpf.Core.v10.1" x:Class="TabStopIssue.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid >
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="1" Grid.Column="0" Content="Name"/>
<dxe:ComboBoxEdit Grid.Row="1" Grid.Column="1" Text="" TabIndex="0" />
<Label Grid.Row="2" Grid.Column="0" Content="Description"/>
<dxe:TextEdit Grid.Row="2" Grid.Column="1" TabIndex="1" />
<Label Grid.Row="1" Grid.Column="2" Content="From Date"/>
<dxe:DateEdit Grid.Row="1" Grid.Column="3" TabIndex="2" />
<Label Grid.Row="2" Grid.Column="2" Content="ToDate"/>
<dxe:DateEdit Grid.Row="2" Grid.Column="3" TabIndex="3" />
</Grid>
<Grid Grid.Row="1">
<TabControl TabIndex="4">
<TabItem Header="Tab1" TabIndex="5">
<Grid >
<TextBox>Enter Text Here</TextBox>
</Grid>
</TabItem>
<TabItem Header="Tab2" TabIndex="6">
<Grid >
<TextBox>Enter Text Here</TextBox>
</Grid>
</TabItem>
<TabItem Header="tab3" TabIndex="7">
<Grid >
<TextBox>Enter Text Here</TextBox>
</Grid>
</TabItem>
<TabItem Header="tab4" TabIndex="8">
<Grid >
<TextBox>Enter Text Here</TextBox>
</Grid>
</TabItem>
<TabItem Header="tab5" TabIndex="9">
<Grid >
<TextBox>Enter Text Here</TextBox>
</Grid>
</TabItem>
</TabControl>
</Grid>
<Grid Grid.Row="2">
<StackPanel HorizontalAlignment="Right">
<Button Content="Button1" IsDefault="True" TabIndex="10" />
<Button Content="Button2" TabIndex="11" />
<Button Content="button3" IsCancel="True" TabIndex="12" />
</StackPanel>
</Grid>
</Grid>
</Grid>
</Window>
嗨塞繆爾,感謝您的幫助。像魅力一樣工作。 – SetiSeeker 2010-10-15 12:20:55