((FrameworkElement)sender).Tag convert to class wp7
How I can convert like:
var me = ((FrameworkElement)sender).Tag as ListBoxItem as Data;
_
public class Data {
public string url { get; set; }
public string title { get; set; }
}
<Button Click="PlayMedia" Tag="{Binding}" 开发者_开发百科 Content="Play" />
Assuming that this code is in the PlayMedia event handler, you can do:
var button = sender as Button;
var data = button.Tag as Data;
If the button is contained in a ListBoxItem, then you'd have to use VisualTreeHelper to find it up the visual tree, starting with the button.
精彩评论