Assume you created a button and you'd like to call several functions when this button is pressed. To do that, we need to add event handlers to the button's click. This way, we don't have to write a common task which might be shared by several buttons many many times
public MainPage()
{
InitializeComponent();
BT1.Content = " Program started";
BT1.Click += BackgroundCOlorChanged;
// Sample code to localize the ApplicationBar
//BuildLocalizedApplicationBar();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
i++;
if (i % 2 == 1)
{
Tb1.Text = "You just hovered";
}
else
{
Tb1.Text = "You hovered again";
}
}
private void BackgroundCOlorChanged(object sender, RoutedEventArgs e)
{
Tb2.Text = "ABCDEF";
}
Monday, January 20, 2014
Subscribe to:
Post Comments (Atom)
Categories
Blog Archive
-
▼
2014
(22)
-
▼
January
(22)
- What is Asynchronous Programming?
- Quality C# (C sharp) Code Examples
- Windows phone emulator not connected to internet
- Using ListBoxes with Buttons and Adding Many Buttons
- Data Binding with a Slider
- Data Binding with Radio Buttons and Two Way Binding
- Data Binding to Control Multiple Objects - Part 1
- High End Windows 8 Phones
- Adding Event Handlers to Controls
- Stack Panel Experiments Part 1
- Using Grid in Windows Phone 8 Development Part 3
- Using Grid in Windows Phone 8 Development Part 2
- Using Grid in Windows Phone 8 Development Part 1
- Simplest Data Binding for Windows Phone 8
- Very simple code using generics
- Casting nedir?
- Generics nedir? Basitce ne ise yariyor
- Windows Store trends, interesting data showing wha...
- How to submit your app to windows app store
- Boxing and Unboxing
- Using Indexers
- Setting logo, publisher name, tile image and some ...
-
▼
January
(22)
Popular Posts
Powered by Blogger.
0 comments:
Post a Comment