title: textbox input to get / set viewmodel
body: <p>I'm sure this has already been asked, but I'm still new to MVVM and WPF, and not too sure what I should be searching for.</p>
  
  <p>I have a viewmodel which includes items in a Model, as well as some additional temporary data items which will all be passed to a process.start().  I have a stackpanel of textbox, and want to allow the user to type in a "ModelName", and if existing, The ViewModel will get and set "TemplateName" associated with the ModelName.</p>
  
  <p>I'm a bit lost on how to implement this. Do I need to create a completely separate ViewModel, which then goes and extracts data from ModelViewModel? Do I just write some code under ModelName's set, where it can validate, query, and set TemplateName?</p>
  
  <p>Model:</p>
  
  <pre><code>public partial class Model
     {
      public string ModelName { get; set; }
      public virtual Template Template { get; set; }
  </code></pre>
  
  <p>and ViewModel, which takes the Model, and some temporary data:</p>
  
  <pre><code>public class LauncherViewModel:ViewModelBase
  {        
      public LauncherViewModel()
      {
          _ESTContext = new ESTContext();
          Models = new ObservableCollection&lt;Model&gt;(_ESTContext.Models); 
      }
  
      private ESTContext _ESTContext;
      private string _modelname;
      private string _serialno;
      private string _sonumber;
      private string _templatename;
      private string _outputname;
      private Model _selectedmodel;
  
      public ObservableCollection&lt;Model&gt; Models { get; set; }
  
      public string ModelName
      {
          get { return _modelname; }
          set
          {
              if (!string.Equals(_modelname, value))
              {
                  _modelname = value;
              };
          }
      }
      public string TemplateName { get { return _templatename;  }}
      public string SerialNo { get { return _serialno; } }
      public string SONumber { get { return _sonumber; } }
      public string OutputName { get { return _outputname; } }
  
      public Model SelectedModel
      {
          get { return _selectedmodel; }
          set
          {
              if (_selectedmodel != value)
              {
                  _selectedmodel = value;
              }
          }
      }
  } 
  </code></pre>
  
  <p>My View:</p>
  
  <pre><code>&lt;DockPanel&gt;
      &lt;StackPanel Margin="0,78,0,68" Width="233" DataContext="{Binding Models}"&gt;
          &lt;ComboBox IsEditable="True" Text="{Binding ModelName}" SelectedItem="{Binding SelectedModel}"/&gt;
          &lt;TextBox Height="23" TextWrapping="Wrap" Text="{Binding SONumber}"/&gt;
          &lt;TextBox Height="23" TextWrapping="Wrap" Text="{Binding SerialNumber}"/&gt;
          &lt;Button Content="Button"/&gt;
      &lt;/StackPanel&gt;
  &lt;/DockPanel&gt;
  </code></pre>