Hey all I am new at WPF so here is my question.
How can I change the text in a textblock from my mainwindow when the textblock is in the window named curTemp.xaml?
curTemp.xaml Code:
Code:
public partial class curTemp : UserControl
{
public string _valTempChange
{
get { return middleForcastCurrentTemp.Text; }
set { middleForcastCurrentTemp.Text = value; }
}
public curTemp()
{
InitializeComponent();
}
}
Xaml of the above UserControl:
Code:
<Grid>
<TextBlock TextWrapping="Wrap" Padding="5" Foreground="White" Panel.ZIndex="7" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="15,-110,-43,0" Width="198" Height="122">
<TextBlock.Effect>
<DropShadowEffect BlurRadius="4" Direction="0" ShadowDepth="0" />
</TextBlock.Effect>
<outlineText:OutlinedTextBlock Height="146" Width="192" TextOptions.TextRenderingMode="Aliased" FontFamily="Segoe UI" FontSize="100" x:FieldModifier="public" x:Name="middleForcastCurrentTemp"
FontWeight="Medium" TextWrapping="Wrap" TextAlignment="Right" Stroke="Black" StrokeThickness="3" Fill="White" Text="10"/>
</TextBlock>
</Grid>
And in my MainWindow code:
Code:
public MainWindow()
{
InitializeComponent();
curTemp _curTempWindow = new curTemp();
_curTempWindow._valTempChange = "55";
}
When I run that code it never shows "55" in the textblock. It only shows my default text "10".
What am I doing incorrectly here?