Public Class OnlyProdBTLPartManagerV 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 OnlyProdBTLPartManagerV As OnlyProdBTLPartManagerV = DirectCast(StackPanel.Parent, OnlyProdBTLPartManagerV) Dim Popup As Primitives.Popup = DirectCast(OnlyProdBTLPartManagerV.Parent, Primitives.Popup) If Not IsNothing(Popup) Then Popup.IsOpen = False End If End Sub End Class