메뉴에 토글 버튼을 넣은 다음 팝업의 IsOpen 속성을 토글 버튼의 IsChecked 속성에 바인딩 할 수 있습니다.
<ToggleButton x:Name="toggle" Content="ToggleButton" HorizontalAlignment="Left" Height="68" Margin="78,104,0,0" VerticalAlignment="Top" Width="102"/>
<Popup IsOpen="{Binding ElementName=toggle, Path=IsChecked}" StaysOpen="False">
<Grid Background="#FFE5E5E5" Height="299" Width="269">
<ToggleButton IsChecked="{Binding ElementName=toggle, Path=IsChecked}" Content="Close" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75"/>
</Grid>
</Popup>
클릭하면 팝업이 사라지지 않도록하려면 StaysOpen을 다시 True (기본값)로 변경하십시오. 이 상황에서 팝업 내부의 토글 버튼은 기본적으로 조금 이상하게 보일 것입니다. 그러나 더보기 좋게 스타일을 지정할 수 있습니다.
모든 코드가 ElementName으로 바인딩하는 대신 동일한 Xaml 파일에있는 경우 모두를 뷰 모델의 부울 속성에 바인딩 할 수 있습니다.