Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this viewmodel first approach - I suspect your inner view isn't being bound (CM doesn't look across control boundaries when applying conventions e.g. it won't apply conventions to nested usercontrols)</p> <pre><code>&lt;Window x:Class="MyApp.MainWindowView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:cal="http://www.caliburnproject.org" xmlns:views="clr-namespace:MyApp" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindowView" Height="300" Width="300"&gt; &lt;Grid&gt; &lt;DockPanel&gt; &lt;Menu DockPanel.Dock="Top"&gt; &lt;MenuItem Header="File"&gt; &lt;MenuItem Header="Open" x:Name="Open"/&gt; &lt;MenuItem Header="Exit" x:Name="Exit"/&gt; &lt;/MenuItem&gt; &lt;/Menu&gt; &lt;StackPanel DockPanel.Dock="Bottom"&gt; &lt;!-- Use ContentControl for sub-views, CM will do it's magic if you bind to the VM property using the standard conventions --&gt; &lt;ContentControl x:Name="SecondView" /&gt; &lt;/StackPanel&gt; &lt;/DockPanel&gt; &lt;/Grid&gt; </code></pre> <p>Then in your main:</p> <pre><code>internal class MainWindowViewModel : Screen, IShell { Regex expression = new Regex(@"^N\d\.C\d\.D\d\.R\d:\s\s\s-\d"); //ex. "N1.C1.D2.R1: -3" // Declare your second VM as a property so you can bind to it via CM conventions public SecondViewModel SecondView { get { return _secondView; } set { _secondView = value; NotifyOfPropertyChange(() =&gt; SecondView); } } public MainWindowViewModel() { SecondView = new SecondViewModel(); } </code></pre> <p>CM will automatically inject the right view into the content controls template and setup the datacontext</p> <p>Alternatively, you can use <code>Bind.Model</code> to bind the VM instance to the view which is more a view-first approach</p> <pre><code> &lt;StackPanel DockPanel.Dock="Bottom"&gt; &lt;views:SecondView cal:Bind.Model="{Binding SecondView}" /&gt; &lt;/StackPanel&gt; </code></pre> <p>(I think it's Bind.Model and not View.Model but I often get the two mixed up, so failing Bind.Model try View.Model)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload