title: MVVM with dynamic commands
body: <p>I need to create a class that is able to create dynamic commands where I can bind to. I have a highly dynamic application with plugins, where the developer creates the plugin only in the backend and controls all things from the backend. The frontend is created in a different "remote" application that has the backend as the DataContext. Here's an example (not the full example), only to show what I want to do:</p>
  
  <pre><code>&lt;Window x:Class="WpfApplication7.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="MainWindow" Height="350" Width="525"&gt;
      &lt;Grid&gt;
          &lt;Button Command="{Binding PressMe}"&gt;PressMe&lt;/Button&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  
  
  namespace WpfApplication7
  {
      /// &lt;summary&gt;
      /// Interaction logic for MainWindow.xaml
      /// &lt;/summary&gt;
      public partial class MainWindow : Window
      {
          TaskViewModel Model = new TaskViewModel();
  
  
          public MainWindow()
          {
              InitializeComponent();
  
              DataContext = Model;
  
              Model.AddCommand("PressMe", (o) =&gt; { Console.WriteLine("TEST"); });
          }
      }
  }
  </code></pre>
  
  <p>So the question is, how do I create something like this, if the XAML needs "well-defined" or "known" properties on which the binding can look at.</p>
  
  <p>I thought of some TaskViewModel and implements IExpando, but somehow the reflection is not performed when hooking into the IExpando methods. Are there other ways to do something like this.</p>
  
  <p>Thanks
  Martin</p>