I have a button with a custom template. Do you have any idea how I can rename the content in the button with a double click.
This is what I have, but from code I cannot access b1.textBox to set the visibility to visible.
<Window.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Ellipse x:Name="outerCircle" Fill="Red" Height="50" Width="50"/>
<Ellipse x:Name="innerCircle" Fill="White" RenderTransformOrigin=".5,.5">
<Ellipse.RenderTransform>
<ScaleTransform ScaleX=".9" ScaleY=".9"/>
</Ellipse.RenderTransform>
</Ellipse>
<Grid>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox x:Name="textBox" Visibility="Collapsed"/>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
void button1_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
//MessageBox.Show(e.Source.ToString());
Button b1 = (Button)e.Source;
// b1.textBox doesn't get displayed here.
}
what about
?