Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import clr
- from System.Windows import Application, Thickness
- from System.Windows.Controls import (
- Button, Canvas, Orientation,
- StackPanel, TextBox #WatermarkedTextBox
- )
- xaml = Application.Current.LoadRootVisual(Canvas(), "app.xaml")
- textblock = xaml.FindName('textblock')
- panel = StackPanel()
- panel.Margin = Thickness(50)
- panel.Orientation = Orientation.Horizontal
- button = Button()
- button.Content = 'Push Me'
- button.FontSize = 18
- button.Margin = Thickness(10)
- waterbox = TextBox() #WatermarkedTextBox()
- waterbox.FontSize = 18
- waterbox.Margin = Thickness(10)
- waterbox.Width = 200
- #waterbox.Watermark = 'Type Something Here'
- def onClick(s, e):
- textblock.Text = waterbox.Text
- button.Click += onClick
- panel.Children.Add(button)
- panel.Children.Add(waterbox)
- xaml.Children.Add(panel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement