클릭하면 이벤트 처리기가있는 사용자 정의 컨트롤이 있습니다. 모든 것이 효과를 발휘하고 이벤트가 바로 시작됩니다.Wpf 사용자 정의 사용자 정의 컨트롤 mouseleftButtonDown 캡처 영역
AddHandler (cu.MouseLeftButtonDown), AddressOf Me.DoSomething
컨트롤이 확장되어 일부 추가 정보가 표시되면 확장됩니다. 또한 사용자가 버튼을 미리 볼 때 축소됩니다. 이건 괜찮아. 하지만 이제 확장 된 영역을 클릭하면 마우스 왼쪽 버튼이 해당 컨트롤에서 실행됩니다. 확장 된 요소에서 IsHitTestVisible을 false로 설정하려고 시도했지만 작동하지 않았습니다. 나는이
OverView.Visibility = Windows.Visibility.Collapsed
가 나는 비주얼로 사각형을 채워 사용하는 경우 다음이 코드를
overView.Visibility = Windows.Visibility.Visible
를 사용할 때
<UserControl x:Class="MyCustomControl">
<StackPanel>
<Grid>
'Stuff thats always visible
</Grid>
<Border IsHitTestVisible="False" Grid.Row="1" HorizontalAlignment="left" BorderThickness="1" VerticalAlignment="top" x:Name="overView" Background="#EEEEEE" Visibility="Hidden" Margin="-325,-95,0,0" Width="auto" Height="auto" Padding="5,5,5,5" BorderBrush="#999999" CornerRadius="3,3,3,3">
<Border IsHitTestVisible="False" x:Name="myBorder" Margin="1" Width="300" Height="225" BorderThickness="1" BorderBrush="#999999" Background="#DDDDDD" CornerRadius="3,3,3,3" HorizontalAlignment="Left" VerticalAlignment="Top">
<Rectangle IsHitTestVisible="False" x:Name="rtgOverView">
</Rectangle>
</Border>
</Border>
</StackPanel>
</UserControl>
개요가 표시됩니다 ... 일부 XAML 그리고 숨 깁니다. 이것은 컨트롤이로드 될 때 발생합니다.
rtgOverView.Fill = visual
개요는 나는 또한 컨트롤의 모든 다른 종류에 MouseLeftButtonDown을 사용하기 때문에 내 customcontrol 주위에 다른 요소를 사용하지 못할이
If x > 350 Then
overView.HorizontalAlignment = Windows.HorizontalAlignment.Left
overView.Margin = New Thickness(-325, -95, 0, 0)
Else
overView.HorizontalAlignment = Windows.HorizontalAlignment.Right
overView.Margin = New Thickness(0, -95, -300, 0)
End If
처럼 뒤에 코드에 배치됩니다. cu.MouseLeftButtonDown 이벤트의 경계가 어떻게 해결되는지 알 수 없습니다.