Guest User

Untitled

a guest
Jul 16th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. public class MainWindowViewModel : INotifyPropertyChanged
  2. {
  3.  
  4. private bool _isVisible;
  5. public bool isVisible
  6. {
  7. get { return _isVisible; }
  8. set
  9. {
  10. _isVisible = value;
  11. NotifyOfPropertyChange("isVisible");
  12. }
  13. }
  14.  
  15. public MainWindowViewModel()
  16. {
  17.  
  18. Window1 X = new Window1();
  19. isVisible = false;
  20. X.Show();
  21. }
  22.  
  23. public event PropertyChangedEventHandler PropertyChanged;
  24. protected void NotifyOfPropertyChange(string name)
  25. {
  26.  
  27. PropertyChangedEventHandler handler = PropertyChanged;
  28. if (handler != null)
  29. {
  30. handler(this, new PropertyChangedEventArgs(name));
  31. }
  32. }
  33. }
  34.  
  35. <Window.Resources>
  36. <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></BooleanToVisibilityConverter>
  37. </Window.Resources>
  38. <Window.Visibility>
  39. <Binding Path="isVisible" Converter="{StaticResource BooleanToVisibilityConverter}" />
  40. </Window.Visibility>
Add Comment
Please, Sign In to add comment