Public Class BTLPartManagerV Private Sub ClosePopUp_Click(sender As Object, e As RoutedEventArgs) Dim Button As Button = DirectCast(sender, Button) Dim StackPanel As StackPanel = DirectCast(Button.Parent, StackPanel) Dim BTLPartManagerV As BTLPartManagerV = DirectCast(StackPanel.Parent, BTLPartManagerV) Dim Popup As Primitives.Popup = DirectCast(BTLPartManagerV.Parent, Primitives.Popup) If Not IsNothing(Popup) Then Popup.IsOpen = False End If End Sub End Class