버전 2.0.0 이상을 사용하는 경우 을 WindowContainer
에 넣고 PreviewKeyDown
이벤트를 사용해야합니다.
XAML :
<xctk:WindowContainer>
<xctk:ChildWindow x:Name="ChildVendorsEdit" IsModal="True" WindowStartupLocation="Center" Caption="Edit"
PreviewKeyDown="ChildVendorsEdit_PreviewKeyDown" >
</xctk:ChildWindow>
</xctk:WindowContainer>
코드 숨김
XAML : 당신이 2.0.0 이하 버전을 사용하는 경우
private void ChildVendorsEdit_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
(sender as Xceed.Wpf.Toolkit.ChildWindow).WindowState = Xceed.Wpf.Toolkit.WindowState.Closed;
}
}
당신이 PreviewKeyDown
이벤트를 사용한다
<xctk:ChildWindow x:Name="ChildVendorsEdit" IsModal="True" WindowStartupLocation="Center" Caption="Edit"
PreviewKeyDown="ChildVendorsEdit_PreviewKeyDown" >
</xctk:ChildWindow>
코드 숨김
private void ChildVendorsEdit_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
(sender as Xceed.Wpf.Toolkit.ChildWindow).WindowState = Xceed.Wpf.Toolkit.WindowState.Closed;
}
}
이 PreviewKeyDown
이벤트 처리기에서 ChildWindow
을 닫으려면 두 가지 옵션이 있습니다 : 사용자가 설정할 수
- 을
WindowState
, Closed
-
- 또는 당신은 할 수
Close
메소드를 호출하십시오.