Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Change WPF TextBlock content within a button

$
0
0

Hi,

How would I change the content of a textblock within a button from code-behind?

My Code:

<Button Click="Example_Click" Margin="112,162,214,40"><Button.Template><ControlTemplate TargetType="Button"><Border Background="#FFF" BorderThickness="4" CornerRadius="20" Width="125" Height="46"><Border.Style><Style TargetType="{x:Type Border}"><Style.Triggers><Trigger Property="IsMouseOver" Value="True"><Setter Property="BorderBrush" Value="#CED58F"/></Trigger></Style.Triggers></Style></Border.Style><TextBlock Margin="30,6,0,0" FontSize="18" FontWeight="Bold" Foreground="#9EB11C">BUTTON</TextBlock></Border></ControlTemplate></Button.Template></Button>

I can't seem to assign an ID.


Viewing all articles
Browse latest Browse all 18858

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>