开发者

How to access the DataTemplate of a DataObject that has the DataTemplate with DataType assigned?

I have a DataObject and a DataTemplate that has the DataType=x:Type DataObject. I have a ContentControl which has as Content the DataObject. On OnContentChanged() of that ContentControl I need to access smtg from the DataTemplate of the new Conten which is a DataObject.

How can I do this?

Inverse, If I have a UIObject and I need to obtain the da开发者_如何学Cta behind I get it trough DataContext, but I don't know how to get it this way.

Please help, Daniel


Daniell,

I think you are going wrong way here. Do what you need to do inside DataObject, then use triggers, attached behaviors, styles and whatsnot inside DataTemplate, to reflect proper state of the DataObject.

The less advisable solution would be VisualTreeHelper, but using it you are asking for a trouble.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜