title: Changing ContentTemplate using DataTriggerBehavior in UWP
body: <p>I am trying to split out my <code>View</code> into multiple <code>UserControl</code>s and then display the appropriate <code>View</code> depending on a certain value.</p>
  
  <p>I accomplish this in WPF like this:</p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;DataTemplate x:Key="CardView"&gt;
          &lt;views:CardView /&gt;
      &lt;/DataTemplate&gt;
      &lt;DataTemplate x:Key="OtherView"&gt;
          &lt;views:OtherView /&gt;
      &lt;/DataTemplate&gt;
      &lt;DataTemplate x:Key="MainView"&gt;
          &lt;views:MainView /&gt;
      &lt;/DataTemplate&gt;
  &lt;/Window.Resources&gt;
  
  ...
  
  &lt;ContentControl Content="{Binding}"&gt;
      &lt;ContentControl.Style&gt;
          &lt;Style TargetType="{x:Type ContentControl}"&gt;
              &lt;Setter Property="ContentTemplate" Value="{StaticResource MainView}" /&gt;
              &lt;Style.Triggers&gt;
                  &lt;DataTrigger Binding="{Binding CurrentView}" Value="Other"&gt;
                      &lt;Setter Property="ContentTemplate" Value="{StaticResource OtherView}" /&gt;
                  &lt;/DataTrigger&gt;
                  &lt;DataTrigger Binding="{Binding CurrentView}" Value="Card"&gt;
                      &lt;Setter Property="ContentTemplate" Value="{StaticResource CardView}" /&gt;
                  &lt;/DataTrigger&gt;
                  &lt;DataTrigger Binding="{Binding CurrentView}" Value="Main"&gt;
                      &lt;Setter Property="ContentTemplate" Value="{StaticResource MainView}" /&gt;
                  &lt;/DataTrigger&gt;
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
      &lt;/ContentControl.Style&gt;
  &lt;/ContentControl&gt;
  </code></pre>
  
  <p>This works great in WPF, and the <code>CurrentView</code> is a <code>string</code> property on the <code>ViewModel</code> that is changed via <code>Button</code> presses/etc.</p>
  
  <p>Since there are no <code>DataTrigger</code>s in UWP, I have read that you can accomplish the same thing using <code>DataTriggerBehavior</code>s instead. So I have tried this:</p>
  
  <pre><code>&lt;Page.Resources&gt;
      &lt;DataTemplate x:Key="PaymentView"&gt;
          &lt;local:PaymentView /&gt;
      &lt;/DataTemplate&gt;
      &lt;DataTemplate x:Key="InvoiceView"&gt;
          &lt;local:InvoiceView /&gt;
      &lt;/DataTemplate&gt;
  &lt;/Page.Resources&gt;
  
  ...
  
  &lt;ContentControl Content="{Binding}"
                  ContentTemplate="{StaticResource InvoiceView}"
                  RelativePanel.AlignLeftWithPanel="True"
                  RelativePanel.AlignRightWithPanel="True"
                  RelativePanel.Below="PageHeader"&gt;
      &lt;interactivity:Interaction.Behaviors&gt;
          &lt;core:DataTriggerBehavior Binding="{x:Bind ViewModel.CurrentView}" Value="Invoice"&gt;
              &lt;core:ChangePropertyAction PropertyName="ContentTemplate" Value="{StaticResource InvoiceView}" /&gt;
          &lt;/core:DataTriggerBehavior&gt;
          &lt;core:DataTriggerBehavior Binding="{x:Bind ViewModel.CurrentView}" Value="Payment"&gt;
              &lt;core:ChangePropertyAction PropertyName="ContentTemplate" Value="{StaticResource PaymentView}" /&gt;
          &lt;/core:DataTriggerBehavior&gt;
      &lt;/interactivity:Interaction.Behaviors&gt;
  &lt;/ContentControl&gt;
  </code></pre>
  
  <p>But for some reason, the <code>ChangePropertyAction</code> is not firing. I know that the <code>CurrentView</code> is changing, as I have set a breakpoint on it. Just in case, here is the property:</p>
  
  <pre><code>private string _currentView;
  public string CurrentView
  {
      get { return _currentView; }
      set { Set(ref _currentView, value); }
  }
  </code></pre>
  
  <p>I am using Template10, so all of my <code>ViewModel</code>s inherit <code>BindableBase</code> through <code>ViewModelBase</code>, so all the <code>OnPropertyChanged</code> stuff should also be working properly (all other properties are working fine).</p>
  
  <p>Anyway, I know the <code>CurrentView</code> is changing, but the <code>ChangePropertyAction</code> behavior is not firing. Is there something I'm missing?</p>