次のポップアップがあります。
<Popup Name="popupBind"
AllowsTransparency="True"
Helpers:FocusHelper.IsFocused="{Binding RelativeSource={RelativeSource Self},
Path=IsOpen,
Mode=OneWay}"
HorizontalOffset="-30"
IsOpen="{Binding IsBindingBegun,
Mode=TwoWay}"
Placement="Bottom"
PlacementTarget="{Binding ElementName=bindButton}"
StaysOpen="False"
>
<Border Background="{DynamicResource {x:Static Styles:CommonStyles.ButtonsPanelBackgroundKey}}"
BorderBrush="Black"
BorderThickness="1"
Padding="0">
<StackPanel HorizontalAlignment="Stretch">
<StackPanel.Resources>
<TemplateSelectors:VersionRangeDataTemplateSelector x:Key="VersionRangeDataTemplateSelector" />
<Converters:RangeToVisibilityConverter x:Key="RangeToVisibilityConverter" />
</StackPanel.Resources>
<StackPanel Margin="5,5,5,2"
HorizontalAlignment="Stretch"
Orientation="Horizontal">
<StackPanel.Resources>
<Style TargetType="Button">
<Setter Property="Margin" Value="5" />
</Style>
</StackPanel.Resources>
<Button Command="{Binding BindCommand}"
>
</Button>
<Button Command="{Binding BindCommand}"
>
</Button>
<Button Command="{Binding BindCommand}"
>
</Button>
<Button Command="{Binding BindCommand}"
>
</Button>
</StackPanel>
<ItemsControl Margin="10,2,5,5"
Focusable="False"
Grid.IsSharedSizeScope="True"
ItemTemplateSelector="{StaticResource VersionRangeDataTemplateSelector}"
ItemsSource="{Binding Path=VersionsVm.TempRanges}">
<ItemsControl.Resources>
<Style TargetType="CheckBox">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Padding" Value="0" />
</Style>
<Style TargetType="TextBlock">
<Setter Property="FontSize" Value="14" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Padding" Value="2" />
</Style>
<DataTemplate x:Key="TwoDistinctVersionsRangeTemplateKey">
<Grid Margin="2,4" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" SharedSizeGroup="_1" />
<ColumnDefinition Width="Auto" SharedSizeGroup="_2" />
<ColumnDefinition Width="Auto" SharedSizeGroup="_3" />
<ColumnDefinition Width="Auto" SharedSizeGroup="_4" />
<ColumnDefinition Width="Auto" SharedSizeGroup="_5" />
<ColumnDefinition Width="Auto" SharedSizeGroup="_6" />
<ColumnDefinition Width="Auto" SharedSizeGroup="_7" />
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0" IsChecked="{Binding IncludeStartEdge, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Column="1" Margin="2,0,5,0">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding IncludeStartEdge}" Value="True">
<Setter Property="Text" Value="[" />
</DataTrigger>
<DataTrigger Binding="{Binding IncludeStartEdge}" Value="False">
<Setter Property="Text" Value="(" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Grid.Column="2"
HorizontalAlignment="Left"
Text="{Binding FromVersionName}"
TextAlignment="Left" />
<TextBlock Grid.Column="3"
Width="10"
Margin="5,0"
HorizontalAlignment="Center"
Text="-"
TextAlignment="Center" />
<TextBlock Grid.Column="4"
HorizontalAlignment="Left"
Text="{Binding ToVersionName}"
TextAlignment="Left" />
<TextBlock Grid.Column="5" Margin="5,0,2,0">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding IncludeEndEdge}" Value="True">
<Setter Property="Text" Value="]" />
</DataTrigger>
<DataTrigger Binding="{Binding IncludeEndEdge}" Value="False">
<Setter Property="Text" Value=")" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<CheckBox Grid.Column="6" IsChecked="{Binding IncludeEndEdge, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</DataTemplate>
<DataTemplate x:Key="FixedVersionRangeTemplateKey">
<StackPanel>
<TextBlock Margin="2,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{Binding FromVersionName}"
TextAlignment="Left" />
<StackPanel>
<StackPanel.Visibility>
<MultiBinding Converter="{StaticResource RangeToVisibilityConverter}">
<MultiBinding.Bindings>
<Binding />
<Binding RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=UserControl}" />
</MultiBinding.Bindings>
</MultiBinding>
</StackPanel.Visibility>
<RadioButton Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType=UserControl},
Path=DataContext.VersionsVm.ChangeTempRangeTypeCommand}"
Content="<" />
<RadioButton Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType=UserControl},
Path=DataContext.VersionsVm.ChangeTempRangeTypeCommand}"
Content="<=" />
<RadioButton Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType=UserControl},
Path=DataContext.VersionsVm.ChangeTempRangeTypeCommand}"
Content="="
IsChecked="True" />
<RadioButton Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType=UserControl},
Path=DataContext.VersionsVm.ChangeTempRangeTypeCommand}"
Content=">=" />
<RadioButton Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType=UserControl},
Path=DataContext.VersionsVm.ChangeTempRangeTypeCommand}"
Content=">" />
</StackPanel>
</StackPanel>
</DataTemplate>
</ItemsControl.Resources>
</ItemsControl>
</StackPanel>
</Border>
</Popup>
私はそれについて非常に奇妙な問題を抱えています。
タブを押すと、左または右のフォーカスがポップアップを離れ、親ウィンドウに移動します。Popus は開いたままです。
なぜこれが起こるのかわかりません。しかし、キーボード ナビゲーションが壊れています。
私がその理由であると疑うことができる唯一のことは、Popup の親が winforms ElementHost 内でホストされている UserControl であることです。
この問題をデバッグする方法がわからないので、役立つヒントをいただければ幸いです。
前もって感謝します。