title: WPF UI Design with user controls
body: <p>As a new comer to WPF, I would like to clarify my approach to build a UI in WPF. I am using WPF with MVVM. My approach is to use a main window which contains user controls which can run several levels deep in the UI tree. For example, I have an editor in a window. Many items can be edited in the editor and the UI for each items are different, but the editor always shows an OK and Cancel button. So the main editor window with OK and Cancel can be shared between several editors. I am designing the app in such a way that the editor user control will just bind the view model for the item which is edited. So when designing  the UI for editing individual items OK or Cancel Button is not pulled in, but simply put the item into the main editor which will provide the buttons. I am pretty sure I can handle the commands correctly with WPF command infrastructure.</p>
  
  <p>If I can make it clear with some xaml here it is.Please dont mind the control placement itself, I mean to explain the basic idea of sharing the Common UI across many items.</p>
  
  <pre><code>&lt;UserControl Name="EditorMainWindow"&gt; 
   &lt;Grid&gt;
     &lt;StackPanel&gt;
          &lt;ItemsControl ItemsSource="{Binding ItemToBeEdited}"&gt;                
          &lt;/ItemsControl&gt;  
         &lt;Button Content="OK" Width="120" Command="{Binding SomethingforOK}" /&gt;
         &lt;Button Content="Cancel" Width="120" Command="{Binding SomethingforCancel}"/&gt;         
      &lt;/StackPanel&gt;               
   &lt;/Grid&gt;
  &lt;/UserControl&gt;     
  </code></pre>
  
  <p>The way I am doing it, the user interface tree can go several levels deep. I will be tremendously benefitted, because if the client ask to change the UI in one particular place, I need not got and change it in many places(provided it is shared).</p>
  
  <p>As I am new to WPF I would like to know if there is any catch in this approach. Could you please tell me if this makes sense or not?</p>