<UserControl x:Class="cdsThemes.TestControl2" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="300" Width="300"> <Grid Background="BlanchedAlmond"> <TextBox Height="23" Margin="25,103,0,0" Name="textBox1" VerticalAlignment="Top" HorizontalAlignment="Left" Width="120">Blah Blah Blah</TextBox> </Grid> </UserControl>And I use it in another simple control:
<UserControl x:Class="cdsThemes.TestControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:cdsThemes" Height="300" Width="300"> <Grid> <local:TestControl2 x:Name="testControl2"></local:TestControl2> </Grid> </UserControl>Lets say I want to change the margin on textBox1 inside of TestControl2 from the XAML in TestControl1. How do I do that?
testControl2.textBox1.Margin = new Thickness(1, 1, 1, 1);just can't seem to work out the XAML.