Oren
Oren

Reputation: 5103

WP7 LongListSelector - find control inside DataTemplate

I have a collection bound to a longlistselector. When a button in the applicationbar is clicked, I want to show a column that was previously hidden inside the longlistselector. How can I get access to the grid inside my datatemplate so I can toggle the column's visibility?

I tried the FindName method but it keeps returning null for the control I want. Am I missing something?

Upvotes: 3

Views: 1230

Answers (1)

Brian Ensink
Brian Ensink

Reputation: 11218

Rather than finding the inside the template, how about binding the Visibility property of the 's contents to a property in your view model. Then all you need to do is change the view models property and the 's contents will show or hide.

Upvotes: 1

Related Questions