Rajen
Rajen

Reputation: 41

Access SurfaceWindow from TagVisualization

I'm looking for an easy way to access my main SurfaceWindow from a TagVisualization that I have. The scenario is that I want to pass along data from my TagVisualization back to the SurfaceWindow. Is there an easy way to do this?

Thanks

Upvotes: 1

Views: 245

Answers (2)

Isak Savo
Isak Savo

Reputation: 35884

Generally, I'd recommend you to think about your overall architecture of your application, since you're introducing a tighter coupling between your controls that is normally desirable.

That said, you can walk your apps visual tree using the VisualTreeHelper

This stack overflow question has a lot of details about finding controls, and especially the answer containing the FindVisualParent helper method

Upvotes: 0

Sascha
Sascha

Reputation: 10347

TagVisualization inherits from FrameworkElement, so a Parent property is available. You can climb the hierarchy that way until you get to the SurfaceWindow.

HTH

Upvotes: 1

Related Questions