ClickMode 열거형

정의

컨트롤에 대해 Click 이벤트를 발생시켜야 하는 시기를 지정합니다.

public enum class ClickMode
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
enum class ClickMode
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public enum ClickMode
Public Enum ClickMode
<object property="enumMemberName"/>
상속
ClickMode
특성

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

필드

Hover 2

마우스 포인터가 컨트롤 위로 이동할 때 Click 이벤트가 발생되도록 지정합니다.

Press 1

마우스 단추를 누르고 마우스 포인터가 컨트롤 위에 있을 때 Click 이벤트가 발생되도록 지정합니다. 키보드를 사용하는 경우 스페이스바 또는 ENTER 키를 누르고 컨트롤에 키보드 포커스가 있을 때 Click 이벤트를 발생시켜야 한다고 지정합니다.

Release 0

왼쪽 마우스 단추를 누르고 놓을 때 Click 이벤트를 발생시키고 마우스 포인터가 컨트롤 위에 있도록 지정합니다. 키보드를 사용하는 경우 스페이스바 또는 ENTER 키를 누르고 놓을 때 Click 이벤트를 발생시키고 컨트롤에 키보드 포커스가 있도록 지정합니다.

예제

다음 예제에서는 ClickMode 열거형을 보여 줍니다.

  • 가리키기 - 마우스 포인터가 첫 번째 단추 위로 마우스를 가져가면 단추의 전경색이 변경됩니다.
  • 누르기 - 두 번째 단추 위에 있는 동안 마우스 왼쪽 단추를 누르면 단추의 전경색이 변경됩니다.
  • 릴리스 - 세 번째 단추 위에 있는 동안 마우스 단추를 누르고 놓으면 단추는 다른 두 단추의 전경색을 원래 색으로 다시 설정합니다.
<StackPanel x:Name="LayoutRoot" Margin="10">
  <Button x:Name="btn1" Content="Hover to Click"
          Click="OnClick1" ClickMode="Hover"
          Margin="5" Width="150"
          HorizontalAlignment="Left"
          Foreground="Green"/>
  <TextBlock x:Name="text1" Margin="5,8,0,0" />
  
  <Button x:Name="btn2" Content="Press to Click"
          Click="OnClick2" ClickMode="Press"
          Margin="5,5,5,5" Width="150" 
          HorizontalAlignment="Left" 
          Foreground="Blue"/>
  <TextBlock x:Name="text2" Margin="5,8,0,0" />
  
  <Button x:Name="btn3" Content="Reset"
          Click="OnClick3" ClickMode="Release"
          Margin="5,5,5,5" Width="150"
          HorizontalAlignment="Left"/>
  <TextBlock x:Name="text3" Margin="5,8,0,0" />
</StackPanel>
void OnClick1(object sender, RoutedEventArgs e)
{
    btn1.Foreground = new SolidColorBrush(Windows.UI.Colors.Blue);
    text1.Text = "Click event occurs on Hover.";
    text2.Text = "";
    text3.Text = "";
}

void OnClick2(object sender, RoutedEventArgs e)
{
    btn2.Foreground = new SolidColorBrush(Windows.UI.Colors.Green);
    text1.Text = "";
    text2.Text = "Click event occurs on Press.";
    text3.Text = "";
}

void OnClick3(object sender, RoutedEventArgs e)
{
    btn1.Foreground = new SolidColorBrush(Windows.UI.Colors.Green);
    btn2.Foreground = new SolidColorBrush(Windows.UI.Colors.Blue);
    text1.Text = "";
    text2.Text = "";
    text3.Text = "Click event occurs on Release.";
}
Private Sub OnClick1(ByVal sender As Object, ByVal e As RoutedEventArgs)
    btn1.Foreground = New SolidColorBrush(Windows.UI.Colors.Blue)
    text1.Text = "Click event handled on Hover."
    text2.Text = ""
    text3.Text = ""
End Sub

Private Sub OnClick2(ByVal sender As Object, ByVal e As RoutedEventArgs)
    btn2.Foreground = New SolidColorBrush(Windows.UI.Colors.Green)
    text1.Text = ""
    text2.Text = "Click event handled on Press."
    text3.Text = ""
End Sub

Private Sub OnClick3(ByVal sender As Object, ByVal e As RoutedEventArgs)
    btn1.Foreground = New SolidColorBrush(Windows.UI.Colors.Green)
    btn2.Foreground = New SolidColorBrush(Windows.UI.Colors.Blue)
    text1.Text = ""
    text2.Text = ""
    text3.Text = "Click event handled on Release."
End Sub

적용 대상