简体   繁体   English

即使鼠标指针移动到wpf中的另一个控件,弹出窗口也不会消失

[英]popup not disappearing even after mouse pointer moved to another control in wpf

I have help buttons across my window.My need is to shop a custom popup control on the mouse over of each help buttons .My custom popup consists of two controls a tooltip and a linkbutton . 我的窗口上有帮助按钮。我需要在每个帮助按钮的鼠标上购买自定义弹出控件。 我的自定义弹出窗口包含两个控件,一个工具提示和一个链接按钮

ToolTip : contains the tips of that button and 工具提示 :包含该按钮的提示和

LinkButton : redirects it into the help file LinkBut​​ton :将其重定向到帮助文件

Here is my button and popup code 这是我的按钮和弹出代码

   <telerik:RadButton Grid.Column="2" HorizontalAlignment="Left" Margin="3,65,0,0" Grid.Row="2" VerticalAlignment="Top"
            Width="23" Height="23" BorderThickness="6" BorderBrush="#4E4E4E" Click="RadButton_Click_1" >
            <Image Source="Images/help.png" />
            <telerik:RadButton.Triggers>
                <EventTrigger RoutedEvent="MouseEnter">
                    <BeginStoryboard>
                        <Storyboard TargetName="TooltipPopup" TargetProperty="IsOpen">
                            <BooleanAnimationUsingKeyFrames  FillBehavior="HoldEnd">
                                <DiscreteBooleanKeyFrame KeyTime="00:00:00"  Value="True" />
                            </BooleanAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </telerik:RadButton.Triggers>
        </telerik:RadButton>

and here is the code for popup 这是弹出的代码

 <Popup PopupAnimation="Fade" Placement="Mouse" AllowsTransparency="True" StaysOpen="False" x:Name="TooltipPopup" >
            <Border   CornerRadius="0" BorderThickness="1">
                <StackPanel Margin="1" Orientation="Horizontal" >
                    <local:UCToolTip></local:UCToolTip>
                </StackPanel>
            </Border>
        </Popup>

When i mouse-over a button the popup shows successfully ,But its not disappearing even after the mouse points another control. 当鼠标悬停在一个按钮上时,弹出窗口显示成功,但即使鼠标指向另一个控件后它也不会消失。

Its disappearing only which i click somewhere in the window. 它消失了,我点击窗口的某个地方。

If user mouseover on button1 the popup need to appear and if user mouseover to button 2 then previous popup needs to be closed and the next button popup need to be shown.The popup must needs to be closed when user points to another button or user click linkbutton inside the popup 如果用户鼠标悬停在button1上,则弹出窗口需要显示,如果用户鼠标悬停在按钮2上,则需要关闭上一个弹出窗口,并且需要显示下一个按钮弹出窗口。当用户指向另一个按钮或用户点击时,必须关闭弹出窗口弹出窗口内的linkbutton

You didn't specified closing the pop-up. 您没有指定关闭弹出窗口。 Try next 尝试下一步

<telerik:RadButton.Triggers>
<EventTrigger RoutedEvent="MouseEnter">
    <BeginStoryboard Name="MyBeginStoryboard">
        <Storyboard TargetName="TooltipPopup" TargetProperty="IsOpen">
            <BooleanAnimationUsingKeyFrames  FillBehavior="HoldEnd">
                <DiscreteBooleanKeyFrame KeyTime="00:00:00"  Value="True" />
            </BooleanAnimationUsingKeyFrames>
        </Storyboard>
    </BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="MouseLeave">
    <StopStoryboard BeginStoryboardName="MyBeginStoryboard" />
</EventTrigger>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM