Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WPF C#4.0
I want to close a window form that is hosting a WPF user control. Something like this as used while closing a current form in window application. But for WPF application I am not able to get reference to user controls parent
 
How to get Form which is hosting this control so that I can close my form
 
this.Close()
Posted 7-Feb-13 21:01pm
Comments
Sergey Alexandrovich Kryukov at 8-Feb-13 2:04am
   
The whole idea to host Form in WPF control is a big abuse. You can host any other control, but not Form.
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can host wpf control or wpf form in windows form
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You can host wpf control or wpf form in windows form
And Got a solution for above question
 Window parent = Window.GetWindow(this);
 parent.Close();
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 380
1 OriginalGriff 230
2 DamithSL 220
3 Zoltán Zörgő 150
4 Maciej Los 135
0 OriginalGriff 7,740
1 DamithSL 5,694
2 Sergey Alexandrovich Kryukov 5,404
3 Maciej Los 5,061
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 8 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100