title: Creating and binding buttons dynamically in a WrapPanel
body: <p>In this scenario, an array of resources are sent to the ViewModel. </p>
  
  <p>The objective is to display these resources as buttons in a WrapPanel in the view.</p>
  
  <p>At this moment, I'm doing this using the C# code below. However, I'd like to do this in the Xaml side. Eventually, I'd like to use DataTemplates to format the buttons with other properties of the Resource class. </p>
  
  <p>What is the best way of approaching this? Thanks in advance.</p>
  
  <pre><code>    public void SetResources(Resource[] resources)
      {
          WrapPanel panel = this.View.ResourcesPanel;
          panel.Children.Clear();
          foreach(Resource resource in resources)
          {
              var button = new Button
              {
                  Tag = resource.Id,
                  Content = resource.Content,
                  Width = 300,
                  Height = 50
              };
              button.Click += this.OnResourceButtonClick;
              panel.Children.Add(button);
          }
      }
  </code></pre>