Reputation: 51
New to wpf applications. I tried to implement this code but the label is always blank no matter what I enter in the textbox:
<Window x:Class="Mufu.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Muf(u)" Height="350" Width="525">
<Grid>
<TextBox Height="23" HorizontalAlignment="Left" Margin="100,200,0,0" Name="textBox3" VerticalAlignment="Top" Width="124" />
<Label Content="{Binding ElementName=textbox3, Path=Text}" Height="48" HorizontalAlignment="Center" Margin="0,30,0,0" Name="label4" VerticalAlignment="Top" Width="445" FontSize="26" />
</Grid>
Upvotes: 0
Views: 74
Reputation: 335
That is because textbox3
and textBox3
are different names. Just change the case and it will work
Upvotes: 1
Reputation: 45096
<Stackpanel>
<TextBox Height="23" HorizontalAlignment="Left" Margin="100,200,0,0" Name="textBox3" VerticalAlignment="Top" Width="124" />
<Label Content="{Binding ElementName=textbox3, Path=Text}" Height="48" HorizontalAlignment="Center" Margin="0,30,0,0" Name="label4" VerticalAlignment="Top" Width="445" FontSize="26" />
</Stackpanel>
Upvotes: 0