 <p>There are a lot of workarounds provided in other answers; they more or less solve your problem. One more workaround:</p> <pre><code>foreach (string name in a.Keys){ StackPanel SP = new StackPanel(); TextBox TB1 = new TextBox(); TextBox TB2 = new TextBox(); SP.Children.Add(TB1); SP.Children.Add(TB2); // ... Content to TextBoxes TB2.Name = name; MainCheckBox.Clicked += (sender, e) =&gt; { TB2.Height = MainCheckBox.IsChecked ? 300 : 0; } } </code></pre> <p>But let's see what should be the correct way.</p> <p>First of all, you need the data items to be presented in a bindable form. This means either derive from <code>DependencyObject</code> or implement <code>INotifyPropertyChanged</code>. Second, you need to put your objects into an <code>ObservableCollection</code>. Then, you can use different containers like <code>ListView</code> or <code>ListBox</code> for displaying the collection of data. For the type representing the data item, you'd need to create a <code>DataTemplate</code>, in which you can put any custom logic you need.</p> <p>You see that this is quite a lot of work, so I wouldn't recommend this approach for really small applications; however as your application grows, this approach will show its benefits.</p>