0
이미지와 팝업이 있습니다. 클릭하면 이미지 팝업이 열립니다.팝업으로 도와주세요
나는 그런 식으로 시작했고 지금은 붙어 있습니다.
UPD ... 사실, 깜빡했는데 ... 팝업을 즉시 표시하지 말고 두 번째 또는 두 번째로 표시합니다. 클릭 한 번이라면 뭔가 다른 것입니다 ... (기본 동작)
이미지와 팝업이 있습니다. 클릭하면 이미지 팝업이 열립니다.팝업으로 도와주세요
나는 그런 식으로 시작했고 지금은 붙어 있습니다.
UPD ... 사실, 깜빡했는데 ... 팝업을 즉시 표시하지 말고 두 번째 또는 두 번째로 표시합니다. 클릭 한 번이라면 뭔가 다른 것입니다 ... (기본 동작)
여기에 원하는 것을 해결할 수있는 방법이 있습니다. 지연 시간은 스토리 보드 정의에서 설정할 수 있습니다. 이 코드를 새로운 wpf 앱 프로젝트 Window.xaml 파일에 삽입하십시오.
<Window.Resources>
<Storyboard x:Key="ShowPopup">
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="LockPopup" Storyboard.TargetProperty="(Popup.IsOpen)">
<DiscreteBooleanKeyFrame KeyTime="00:00:00.5" Value="True" />
</BooleanAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="HidePopup" Storyboard.TargetName="LockPopup" Storyboard.TargetProperty="(Popup.IsOpen)">
<BooleanAnimationUsingKeyFrames>
<DiscreteBooleanKeyFrame KeyTime="00:00:00.5" Value="False" />
</BooleanAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
<Grid x:Name="grid" ShowGridLines="True">
<Image x:Name="LockImage" Stretch="None" >
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<GeometryDrawing Brush="Black">
<GeometryDrawing.Geometry>
<EllipseGeometry RadiusX="10" RadiusY="10"/>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
<Image.Triggers>
<EventTrigger RoutedEvent="Image.MouseLeftButtonDown">
<BeginStoryboard Storyboard="{StaticResource ShowPopup}"/>
</EventTrigger>
<EventTrigger RoutedEvent="Image.MouseLeave">
<BeginStoryboard Storyboard="{StaticResource HidePopup}"/>
</EventTrigger>
</Image.Triggers>
</Image>
<Popup x:Name="LockPopup" PlacementTarget="{Binding ElementName=LockImage}" DataContext="{Binding}" Placement="Bottom">
<TextBlock Text="This is a popup" Background="White" Foreground="Black" />
</Popup>
</Grid>
아 감사합니다 ... 모든 클릭에 적용됩니다. 이제 ... 몇 초 후에 팝업을 표시하려고하지만 사용자가 기다리지 않고 방금 버튼을 누르면 기본 이벤트가 실행됩니다. 예를 들어 메시지를 보여줍니다? – Agzam
예, 정의 된 이벤트를 실행 한 다음 스토리 보드를 실행합니다. –