开发者

binding to items self (this) for a button in a itemtemplate/datatemplate?

开发者 https://www.devze.com 2023-03-09 02:33 出处:网络
I\'ve found similar examples for this but nothing that solves my exact issue :( I\'m using silverlight on Phone7, and I have a itemslist that I bind a List to the ItemsSource.

I've found similar examples for this but nothing that solves my exact issue :(

I'm using silverlight on Phone7, and I have a itemslist that I bind a List to the ItemsSource.

In my dataTemplate, I have a button, and what I really want to do is set the button.tag property to give me back the original instance of the myClass object that is bound to that template.

I cant seem to figure out how in the xaml binding, to speci开发者_如何学编程fy a binding to the object instance for that template. Any help is appreciated


I figured it out for anyone that needs it in the future - What you need is

Tag="{Binding BindsDirectlyToSource=True}"

That will bind to the source of that itemtemplate

0

精彩评论

暂无评论...
验证码 换一张
取 消