日期:2014-05-17 浏览次数:20840 次
<Button x:Name="button1" >
<Button.Template>
<ControlTemplate>
<Grid>
<TextBox Height="57" HorizontalAlignment="Left" Margin="46,12,0,0" Name="textBox1" VerticalAlignment="Top" Width="190" FontSize="40" />
</Grid>
</ControlTemplate>
</Button.Template>
</Button>
<Button Name="button2" Content="Button" Height="23" HorizontalAlignment="Left" Margin="108,176,0,0" VerticalAlignment="Top" Width="75" Click="button1_Click" />
<Button x:Name="button1">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<TextBox Height="57" Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=Content}"
HorizontalAlignment="Left" Margin="46,12,0,0" VerticalAlignment="Top" Width="190" FontSize="40" />
</Grid>
</ControlTemplate>
</Button.Template>
</Button>
<Button Name="button2" Content="{Binding ElementName=button1,Path=Content}" Height="23" HorizontalAlignment="Left" Margin="108,176,0,0" VerticalAlignment="Top" Width="75" />