ContentControl inside Popup not rendering View

Topics: UI Architecture
Mar 6, 2012 at 4:13 PM
Edited Mar 7, 2012 at 8:51 AM


I have a ViewModel that contains another ViewModel that I want to render occasionally on screen using the <Popup> control.  I have a ContentControl inside the popup as follows:


<Popup IsOpen="True" >
  <StackPanel Background="Green">
    <TextBlock Text="This is a popup" />
    <ContentControl x:Name="Types"  />


This is wired up using Caliburn and should show the View based on the ViewModel type but it doesn't.

I have another area of the UI that is not inside a Popup using the same mechanism and that is showing the View correctly.

Any Ideas?

* The above xaml is for testing purposes only.


Mar 7, 2012 at 4:15 AM
Edited Mar 7, 2012 at 4:29 AM

This might work for you better with Co-Routines to use the WindowManager to create a popup window (not exactly using the popup control) to add something that another thing is dependant on. Aircraft -> AircraftType for example where Aircraft is the actual tail (N11112) number related to the actual type of aircraft (Embraer or Boeing for example). So if the type isn't in the database I have a button that produces the AddTypeViewModel which is linked to the AddTypeView... Morgan.

Mar 7, 2012 at 10:43 AM

I can get it working using the WindowManager, however this means they are two separate views/ windows that cannot interact i.e. its difficult to get the view to disappear when clicking or navigating away from the popup view.

If it were in a Popup element then this would be trivial as it would be part of the controlling view.


Mar 7, 2012 at 2:28 PM

Since the Popup lives in a different Logical and Visual Tree, I fear that Caliburn is not able to identify the named ContentControl.

Have you tried using the View.Model property directly, instead of relying on the naming convention?

Mar 7, 2012 at 3:19 PM

That worked many thanks :-)