C#/WPF

[WPF]Close UserControl Window in ViewModel with Module

딸기우유중독 2022. 12. 23. 14:10
void ExecuteCloseWindowCommand(string parameter)
        {
            Window window= null;
            Control currentControl = System.Windows.Input.Keyboard.FocusedElement as Control;
            
            if (currentControl != null)
                window = Window.GetWindow(currentControl);

            window.Close();
            
            //Application.Current.Shutdown();
        }

 

 

DevExpress에서 아래와 같은 방법으로 

현재 윈도우 조작할 수 있음.

 

 

728x90