This is a migrated thread and some comments may be shown as answers.

Getting reference to a text box in a Tile

2 Answers 36 Views
TileView
This is a migrated thread and some comments may be shown as answers.
Cuthahotha
Top achievements
Rank 1
Cuthahotha asked on 01 Dec 2010, 07:26 PM
Assume a multi player word game.  User puts in a word, sends it to the server via web service.  client app polls for new words and put them in the right list box in the right tile. 

Tiles generated in code based on colleciton or list. (not bound, just iterating the list and adding tiles for each item.) Not many tiles, unusally less than 10.

 Each tile contains a Button, TextBox, and List.  These are defined in XAML. and vary depending on small, large or resized in the fluid content control.

When the user types in a text box located in a tile, then clicks the button in the same tile, the code in the onclick event needs to find the text box and process the text in the box, and put it in the list box.

I'm having difficulty getting a handle on the text box in the button click event.

It doesnt seem to be as easy as iterate over the tiles, and get the text block in the tile... 

Thoughts?

2 Answers, 1 is accepted

Sort by
0
Accepted
Zarko
Telerik team
answered on 02 Dec 2010, 04:19 PM
Hello Cuthahotha,

 You can try to get it with the ChildrenOfType method like that:

private void Button_Click(object sender, RoutedEventArgs e)
{
    RadTileViewItem tile = (e.OriginalSource as Button).ParentOfType<RadTileViewItem>();
    if (tile != null)
    {
       TextBox tb = tile.ChildrenOfType<TextBox>().FirstOrDefault();
    }
}
If you have further questions feel free to ask.

 

Best wishes,
Zarko
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Cuthahotha
Top achievements
Rank 1
answered on 14 Dec 2010, 10:40 PM
Perfect!  Thanks....
Tags
TileView
Asked by
Cuthahotha
Top achievements
Rank 1
Answers by
Zarko
Telerik team
Cuthahotha
Top achievements
Rank 1
Share this question
or