title: Creating dynamic WPF context menu
body: <p>I have an ObservableCollection in my ViewModel and I want to create a ContextMenu which is bindded to that collection where every item in the collection has a submenu and all submenus are the same.
  For example the collection is {10,20,30} and the submenu is
  - Param (MenuItem)
  -    Set (MenuItem)
  -    Reset (MenuItem)
  - Clear (MenuItem)
  so that the final context menu would look something like this\
  - 10
  -   Param
  -     Set
  -     Reset
  -   Clear
  - 20
  -   Param
  -     Set
  -     Reset
  -   Clear
  - 30
  ....
  I've tried creating a resource</p>
  
  <pre><code>&lt;x:Array x:Key="MenuResource" Type=Control&gt;
    &lt;MenuItem Header="Param"/&gt;
      &lt;MenuItem Header="Set"/&gt;
      &lt;MenuItem Header="Reset"/&gt;
    &lt;MenuItem Header="Clear"/&gt;  
  &lt;/x:Array&gt;
  </code></pre>
  
  <p>and setting to ItemSource Property in MenuItem Style of the ItemContainerStyle of the ContextMenu.
  Nothing seems to work.</p>
  
  <p>Can someone please show me the XAML way to do this.
  Thanks</p>