title: Binding data to XAML while runtime
body: <p>I build a Chart with a Grid and some Rectangles, like in this Post:
  <a href="https://stackoverflow.com/questions/6853954/drawing-a-chart-in-wpf-c-sharp-design-questions/28945544#28945544">Drawing a chart in WPF C# design questions</a></p>
  
  <p>Now I save this Chart to an XAML-File to fill it later by another program.</p>
  
  <p>In this chart I need to bind three Values:
  1. Labels
  2. MaxHeight - Height (by each bar)
  3. Height</p>
  
  <p>My Problem is, that I don't know how to bind it correctly for using it in another application.</p>
  
  <p>The other Application could give me a list or an array with the values and the label, but I dont know how I should bind unknown values to the Rectangles.</p>
  
  <p>In the code below I binded the "ChartLabel" but I need all Chart Labels not only one.
  When I creating the chart I don't now how much bars I will have later.</p>
  
  <pre><code>  &lt;Grid ShowGridLines="True" Background="#FFF5F5DC" Width="Auto" Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"&gt;
              &lt;Rectangle Fill="#FF0000FF" Grid.Column="{Binding Path=Test6_Val, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /&gt;
              &lt;TextBox Text="{Binding Path=ChartLabel, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" BorderBrush="#00FFFFFF" Background="#00FFFFFF" HorizontalAlignment="Center" Grid.Column="5" Grid.Row="10" /&gt;
              &lt;Rectangle Fill="#FF0000FF" Grid.Column="{Binding Path=Test7_Val, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /&gt;
              &lt;TextBox Text="{Binding Path=ChartLabel, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" BorderBrush="#00FFFFFF" Background="#00FFFFFF" HorizontalAlignment="Center" Grid.Column="6" Grid.Row="10" /&gt;
              &lt;Rectangle Fill="#FF0000FF" Grid.Column="{Binding Path=Test8_Val, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /&gt;
              &lt;TextBox Text="{Binding Path=ChartLabel, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" BorderBrush="#00FFFFFF" Background="#00FFFFFF" HorizontalAlignment="Center" Grid.Column="7" Grid.Row="10" /&gt;
              &lt;Rectangle Fill="#FF0000FF" Grid.Column="{Binding Path=Test9_Val, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /&gt;
              &lt;TextBox Text="{Binding Path=ChartLabel, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" BorderBrush="#00FFFFFF" Background="#00FFFFFF" HorizontalAlignment="Center" Grid.Column="8" Grid.Row="10" /&gt;
              &lt;Rectangle Fill="#FF0000FF" Grid.Column="{Binding Path=Test10_Val, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /&gt;
              &lt;TextBox Text="{Binding Path=ChartLabel, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" BorderBrush="#00FFFFFF" Background="#00FFFFFF" HorizontalAlignment="Center" Grid.Column="9" Grid.Row="10" /&gt;
     &lt;/Grid&gt;
  </code></pre>