wpfvb.netxamluser-controlsmainwindow

Call mainwindows from UserControl


I have a Window(mainwindows.xaml) where there's a label.Now,i've created a UserControl(Just a basic button)..On Window_load,i'm adding the UserControl in a canvas(in mainwindow) using this :

Dim con as new myUserControl

Canvas.Children.Add(con)

Now What i want is,when i click the UserControl,the label will be hidden..How do i do this ??

I've tried creating a WPF CUSTOM CONTROL LIBRARY but don't know how to work with it ??


Solution

  • Fixed it myself....Guess that was really easy.In usercontrol,just used this :

       Dim hm As MainWIndow = Window.GetWindow(Me)
       hm.Lbl1.Visibility=Visibility.Hidden