0
요소를 클릭하고 마우스 버튼을 누른 상태에서 DragMove를 트리거하는 데 사용되는 요소가 XAML에 있습니다.DragMove 다음에 MouseLeftButtonUp이 호출되지 않습니다.
<Grid>
<CheckBox x:Name="myCheckBox" IsChecked="{Binding IsDragging}">I am red square dragging!</CheckBox>
<Rectangle x:Name="myRect" Width="100" Height="100" Fill="Red"/>
</Grid>
이벤트 처리는 다음과 같은 방법으로 코드 숨김 수행됩니다
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
myRect.MouseLeftButtonDown += myRect_MouseLeftButtonDown;
myRect.MouseLeftButtonUp += myRect_MouseLeftButtonUp;
}
void myRect_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
IsDragging = false;
}
void myRect_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
IsDragging = true;
DragMove();
}
true로 설정 한 후 IsDragging false로 설정되지 않습니다 그래서 심지어 작품을 드래그하지만, myRect_MouseLeftButtonUp가 호출되지 않습니다. 이 작업을 어떻게 수행합니까?
보너스로,이 질문에 답하기 위해 동축 케이블을 사용하는 요소의 이미지가 있습니다.