Control.MouseDoubleClick 이벤트
정의
마우스 단추를 두 번 이상 클릭할 때 발생합니다.Occurs when a mouse button is clicked two or more times.
public:
event System::Windows::Input::MouseButtonEventHandler ^ MouseDoubleClick;
public event System.Windows.Input.MouseButtonEventHandler MouseDoubleClick;
member this.MouseDoubleClick : System.Windows.Input.MouseButtonEventHandler
Public Custom Event MouseDoubleClick As MouseButtonEventHandler
이벤트 유형
예제
다음 예제에서는 이벤트 처리기를 연결 하는 방법의 MouseDoubleClick 이벤트입니다.The following example shows how to attach an event handler to the MouseDoubleClick event.
<Button Name="btn" Background="Red"
MouseDoubleClick="ChangeBackground">
Background
</Button>
다음 예제에서는 이벤트 처리기는 MouseDoubleClick 이벤트입니다.The following example shows the event handler of the MouseDoubleClick event.
void ChangeBackground(object sender, RoutedEventArgs e)
{
if (btn.Background == Brushes.Red)
{
btn.Background = new LinearGradientBrush(Colors.LightBlue, Colors.SlateBlue, 90);
btn.Content = "Control background changes from red to a blue gradient.";
}
else
{
btn.Background = Brushes.Red;
btn.Content = "Background";
}
}
Private Sub ChangeBackground(ByVal Sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs)
If (btn.Background Is Brushes.Red) Then
btn.Background = New LinearGradientBrush(Colors.LightBlue, Colors.SlateBlue, 90)
btn.Content = "Control background changes from red to a blue gradient."
Else
btn.Background = Brushes.Red
btn.Content = "Background"
End If
End Sub
설명
이 라우트된 이벤트를 요소 트리를 통해 버블링 경로 따르는 것 처럼 보이지만, 실제로 각각 사용 하 여 요소 트리를 따라 발생 하는 직접 라우트된 이벤트 UIElement합니다.Although this routed event seems to follow a bubbling route through an element tree, it actually is a direct routed event that is raised along the element tree by each UIElement. 설정 하는 경우는 Handled 속성을 true
에 MouseDoubleClick 후속 이벤트 처리기 MouseDoubleClick 경로의 이벤트 발생 Handled 로 false
합니다.If you set the Handled property to true
in a MouseDoubleClick event handler, subsequent MouseDoubleClick events along the route will occur with Handled set to false
. 컨트롤을 두 번 클릭할 때 알림을 받도록 하 고 애플리케이션에서 이벤트를 처리 하려면 사용자 컨트롤에 대 한 상위 수준 이벤트입니다.This is a higher-level event for control consumers who want to be notified when the user double-clicks the control and to handle the event in an application.
마우스 두 번 클릭을 처리 하려는 컨트롤 작성자 사용 해야 합니다 MouseLeftButtonDown 이벤트 때 ClickCount 2 일입니다.Control authors who want to handle mouse double clicks should use the MouseLeftButtonDown event when ClickCount is equal to two. 이렇게 하면 상태의 Handled 요소 트리의 다른 요소는 이벤트를 처리 하는 경우에 적절 하 게 전파 합니다.This will cause the state of Handled to propagate appropriately in the case where another element in the element tree handles the event.
합니다 Control 클래스를 정의 합니다 PreviewMouseDoubleClick 및 MouseDoubleClick 이벤트 하지만 하지 해당 단일 클릭 이벤트입니다.The Control class defines the PreviewMouseDoubleClick and MouseDoubleClick events, but not corresponding single-click events. 사용자가 컨트롤을 한 번 클릭 하는 경우를 확인 하려면 처리를 MouseDown 이벤트 (또는 해당 항목 중 하나) 확인 하 고 있는지 여부를 ClickCount 속성 값은 1입니다.To see if the user has clicked the control once, handle the MouseDown event (or one of its counterparts) and check whether the ClickCount property value is 1.
라우팅 이벤트 정보Routed Event Information
식별자 필드Identifier field | MouseDoubleClickEvent |
라우팅 전략Routing strategy | 직접Direct |
대리자Delegate | MouseButtonEventHandler |