Advertisement
Guest User

Untitled

a guest
May 25th, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import clr
  2.  
  3. from System.Windows import Application, Thickness
  4. from System.Windows.Controls import (
  5. Button, Canvas, Orientation,
  6. StackPanel, TextBox #WatermarkedTextBox
  7. )
  8.  
  9. xaml = Application.Current.LoadRootVisual(Canvas(), "app.xaml")
  10. textblock = xaml.FindName('textblock')
  11.  
  12. panel = StackPanel()
  13. panel.Margin = Thickness(50)
  14. panel.Orientation = Orientation.Horizontal
  15.  
  16.  
  17. button = Button()
  18. button.Content = 'Push Me'
  19. button.FontSize = 18
  20. button.Margin = Thickness(10)
  21.  
  22. waterbox = TextBox() #WatermarkedTextBox()
  23. waterbox.FontSize = 18
  24. waterbox.Margin = Thickness(10)
  25. waterbox.Width = 200
  26. #waterbox.Watermark = 'Type Something Here'
  27.  
  28. def onClick(s, e):
  29. textblock.Text = waterbox.Text
  30.  
  31. button.Click += onClick
  32.  
  33. panel.Children.Add(button)
  34. panel.Children.Add(waterbox)
  35.  
  36. xaml.Children.Add(panel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement