Wpf 当用户控件中包含弹出窗口时,弹出窗口中包含的控件无法接收鼠标单击

Wpf 当用户控件中包含弹出窗口时,弹出窗口中包含的控件无法接收鼠标单击,wpf,Wpf,我有一个UserControl,其格式如下: <UserControl x:Class="apparition2.Tabs.Scene.SceneMultiPicker" x:Name="control" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/w

我有一个
UserControl
,其格式如下:

<UserControl x:Class="apparition2.Tabs.Scene.SceneMultiPicker"
             x:Name="control"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mwt="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
             xmlns:local="clr-namespace:apparition2.Tabs.Scene">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <TextBlock x:Name="PART_SelectedItems" HorizontalAlignment="Stretch" />
        <Button x:Name="PART_Button" Grid.Column="1" Width="20" Click="PART_Button_Click" />

        <Popup x:Name="PART_Popup" Width="200" Height="200" AllowsTransparency="True"
               PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"
               HorizontalOffset="5" VerticalOffset="5" Placement="Left" PlacementTarget="{Binding ElementName=PART_Button}">
            <mwt:SystemDropShadowChrome Color="#71000000" Margin="0,0,5,5">
                <Border Background="White" BorderBrush="Black" BorderThickness="1" CornerRadius="3" Padding="5">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <TextBox HorizontalAlignment="Stretch" Margin="0,0,0,5" />

                        <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Visible"
                                      Grid.Row="1">
                            <ItemsControl x:Name="PART_Items" ItemsSource="{Binding ElementName=control, Path=Items}">
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <CheckBox Margin="5,3" Content="{Binding Name}" IsChecked="{Binding IsSelected, Mode=TwoWay} />
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                            </ItemsControl>
                        </ScrollViewer>
                    </Grid>
                </Border>
            </mwt:SystemDropShadowChrome>
        </Popup>
    </Grid>
</UserControl>


要使Popup receive focus中包含的子控件(如文本框和复选框)成为焦点,请尝试在可视树父元素中设置
Focusable=“False”

如果有任何线索,则会出现更奇怪的行为。当弹出窗口包含在用户控件中时,鼠标单击会不规则地清除弹出窗口的可见性。我可以在弹出窗口中单击同一个位置九次,然后在第十次单击时消失弹出窗口。当弹出窗口内联时不会发生这种情况。我遇到了完全相同的问题,非常令人沮丧。。。