>><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>>>
>><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> >>>>
>>testControl2.textBox1.Margin = new Thickness(1, 1, 1, 1); >>>>
>public Thickness TextBoxMargin > { > get { return textBox1.Margin; } > set { textBox1.Margin = value; } > } >Then, in containing controls XAML you can use:
> <local:TestControl2 x:Name="testControl2" TextBoxMargin="1,1,1,1"></local:TestControl2>But I think creating a DependencyProperty is the 'correct' answer.