title: DataTemplateSelector and update binding manually
body: <p>I am using a DataTemplateSelector to swap input method for user based on whether he wants to enter text or pick a date value. Which means the selector switches between a TextBox and a DatePicker. Each control must use explicit way to update binding source. To sum up the user could pick a date or he could enter a text and once he is done he may click on apply button to update sources. Though only apply button updates the souce and not on focus lost.</p>
  
  <p>The owner control of the DataTemplateSelector is a custom ContentControl called InputControl which is futhermore part of a UserControl.</p>
  
  <p>Here is a small piece of pseudocode just to visualize things better:</p>
  
  <pre><code>public class InputControl : ContentControl
  {
    //// this method shall be executed once user clicks on apply button
    //// inside this method the source of binding shall be updated no matter what input method used chose
    public void Update()
    {
    }
  }
  </code></pre>
  
  <p>Xaml looks kinda like this:</p>
  
  <pre><code>&lt;UserControl&gt;
   &lt;UserControl.Resources&gt;
    &lt;DataTemplate x:key="text"&gt;
      &lt;TextBox Text="{Binding Mode=TwoWay, Path=., UpdateSourceTrigger=Explicit}"/&gt;
    &lt;/DataTemplate&gt;
  
    &lt;DataTemplate x:key="date"&gt;
      &lt;DatePicker DateValue="{Binding Mode=TwoWay, Path=., UpdateSourceTrigger=Explicit}"/&gt;
    &lt;/DataTemplate&gt;
  
  
    &lt;MyDataTemplateSelector x:key="myDataTemplateSelector"
                          TextTemplate="{StaticResource text}"
                          DateTemplate="{StaticResource date}"&gt;
    &lt;/MyDataTemplateSelector&gt;
   &lt;/UserControl.Resources&gt;
  
   &lt;Inputcontrol Content="{Binding Path=., Mode=TwoWay}" ContentTemplateSelector="{StaticResource myDataTemplateSelector}" /&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>The selector looks like this</p>
  
  <pre><code>Public class MyDataTemplateSelector : DataTemplateSelector
  {
    Public DataTemplate TextTemplate { get; set;}
  
    Public DataTemplate  DateTemplate { get; set;}
  
    Public DataTDemplate Select(.....)
    {
      ....
    }
  }
  </code></pre>
  
  <p>Now the problem is how do I update the binding source from InputControl no matter what control is selected inside the template? If you read the comments above the method InputControl.Update() you will understand better what I mean with user updating source no matter what template.</p>
  
  <p>If its TextBox selected the user shall be able to just call InputControl.Update() and it will update textbox binding source. If its DatePicker the user shall be able to do the same which is only to call InputControl.Update(). The source will get updated and Inputcontrol.Update() is a central point to trigger updating process no matter what control.</p>
  
  <p>To sum up the method Update() is pretty central and updates the binding source no matter if its TextBox or DatePicker.</p>
  
  <p>How do I do that?</p>