title: How to perform data binding of WPF/XAML using PowerShell
body: <p>I have several PowerShell modules I've developed using WPF/XAML and one of them uses an example I found and used to bind a DataGrid ItemSource property to a variable called "resultsData":</p>
  
  <p><code>&lt;DataGrid Name="gridResults" ItemsSource="{DynamicResource resultsData}"/&gt;</code></p>
  
  <p>Then in the Window.Resources section of my XAML file there is a reference made to the data binding value:</p>
  
  <p><code>&lt;Window.Resources&gt;
          &lt;x:Array x:Key="resultsData" Type="sys:Object"/&gt;
  &lt;/Window.Resources&gt;</code></p>
  
  <p>Finally, in PowerShell I can update the DataGrid's property as follows:</p>
  
  <p><code>$uiHash.Window.Resources["resultsData"] = $uiHash.resultsHash</code></p>
  
  <p>This works really well and I'm trying to replicate it in another project where I'm simply trying to bind the text property of a TextBlock using the Windows.Resources section in my XAML file. The problem is I have no idea what to put in that section to make it work.</p>
  
  <p>I've tried using the same <code>&lt;x:Array&gt;</code> tag but it's obviously not an array. I've tried <code>&lt;x:Code&gt;</code> and <code>&lt;x:Null&gt;</code> and a multitude of other options which all result in a failure to load the window along with Visual Studio's visual designer barfing...</p>
  
  <p>Could someone help me understand what to put in the Windows.Resources section to ensure I can reference these properties in PowerShell through the Window.Resources object?</p>