Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
0
Answer
How to use a textbox contents thats inside a data template
Robert
12y
1k
1
Reply
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"
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
USB Connection
Final part: animation part