私はここにあるコントロールテンプレートを持っています:
<ControlTemplate x:Key="DialogWindowTemplate" TargetType="{x:Type w:DialogWindow}">
<Border d:DesignHeight="500" d:DesignWidth="700" CornerRadius="5" Background="{StaticResource ContrastWhiteBrush}"
BorderThickness="1" BorderBrush="{StaticResource ContentNormalBrush}">
<Grid>
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="10,0,10,0">
<Button Content="{TemplateBinding ActionName}" Style="{StaticResource ButtonStyle}" KeyboardNavigation.TabIndex="1"
VerticalAlignment="Center" Margin="10,0,10,0" Padding="5,0,5,0" FontWeight="Bold" Height="30" Width="75"
Command="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ActionCommand}"/>
<TextBlock Text="{x:Static loc:Controls.Dialog_Or}" Style="{StaticResource ContentNormalFontStyle}"
VerticalAlignment="Center" Margin="0"/>
<Button Style="{StaticResource CancelButtonStyle}" VerticalAlignment="Center" Margin="10,0,10,0" KeyboardNavigation.TabIndex="2"
Command="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CancelCommand}"/>
</StackPanel>
</Grid>
</Border>
</ControlTemplate>
これは .cs ファイルです
public DialogWindow()
{
// load the template
ResourceDictionary rd = new ResourceDictionary();
rd.Source = new Uri(TEMPLATE_URI);
this.Resources.MergedDictionaries.Add(rd);
this.Template = this.Resources["DialogWindowTemplate"] as ControlTemplate;
this.WindowStyle = WindowStyle.None;
this.AllowsTransparency = true;
this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, CloseCommandHandler));
this.CommandBindings.Add(new CommandBinding(_escCommand, CloseCommandHandler));
}
私の問題は次のとおりです。考えられるすべてのオプションを試しましたが、それらのボタンに対してタブナビゲーションが機能しません。しかし、Ctrl + Tabを押すと機能します。この KeyBoard.ControlTabNavigation = "None" も試しました。しかし、うまくいきません。
ありがとう