Hello, I'm still a beginner with programming but I'm on my way.I retrieve weather data trough an internet link (xml) the data (condition) inside that xml is linked via data binding in a text block named "hulptextblok".Now I would like to use the if statement on that textbox but I get the error saying that the is not found.This is because the textbox control is located inside a data template.I have beentrieng for over 2 days toget it to work but with no succes I just Hope that you can shed some light on this problem. :-)
Xaml:
<ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" Height="99" > <Grid Height="100"> <Grid.ColumnDefinitions> <ColumnDefinition Width="100"></ColumnDefinition> <ColumnDefinition Width="*"> </ColumnDefinition> </Grid.ColumnDefinitions> <TextBlock Text="{Binding Path=condition}" Grid.Column="1" Margin="10,75,10,0" Name="hulpBlock"></TextBlock> </Grid> </StackPanel> </DataTemplate> </ListBox.ItemTemplate>
Xaml.cs:
if (hulpBlock.Text == "Partly Cloudy") { weatherframe.Source = (ImageSource)new ImageSourceConverter().ConvertFromString("WeatherIcons/03.png"); }
So what want is that if the text that is recieved inside the textbox matches "Partly Cloudy" the image source to change to "WeatherIcons/03.png"