33. Routed Events
Routed events normally appear as pair. The first is a tunnellingevent calledPreviewMouseDownand the second is the bubbling calledMouseDown. They don't stop routing if they reach an event handler. To stop routing then you have to set e.Handled= true;
34. Routed Events
•Tunneling
–The event is raised on the root element and navigates down to the visual tree until it reaches the source element or until the tunneling is stopped by marking the event as handeld. By naming convention it is calledPreview...and appears before corresponding bubbling event.
•Bubbling
–The event is raised on the source element and navigates up to the visual tree until it reaches the root element or until the bubbling is stopped by marking the event as handled. The bubbling event is raised after the tunneling event.
•Direct
–The event is raised on the source element and must be handled on the source element itself. This behavior is the same as normal.NET events.
49. Visit and know more about http://msdn.microsoft.com/en-us/library/ff648465.aspx
Prism provides guidance to help you more easily design and build, flexible, and easy-to-maintain client business apps that run on Windows Runtime, Windows Presentation Foundation (WPF) desktop, Silverlight, or Windows Phone 7. These apps may start small and evolve over time.
Visit also: http://compositewpf.codeplex.com/
67. Binding, Templates and XML Example
void twitter_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgse)
{
if (e.Error!= null) return;
XElementxmlTweets= XElement.Parse(e.Result);
lstTwitter.ItemsSource=
from tweet in xmlTweets.Descendants("status")
select new TwitterItem{ ImageSource= tweet.Element("user").Element("profile_image_url").Value, Message=tweet.Element("text").Value};
}
private void button2_Click(object sender, RoutedEventArgse)
{
WebClienttwitter = new WebClient();
// Handle downloaded data when finished
twitter.DownloadStringCompleted+= new DownloadStringCompletedEventHandler(twitter_DownloadStringCompleted);
// Set the site
twitter.DownloadStringAsync(new Uri("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=" + textBox1.Text));
}
68. Binding, Templates and XML Example
void twitter_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgse)
{
if (e.Error!= null) return;
XElementxmlTweets= XElement.Parse(e.Result);
lstTwitter.ItemsSource=
from tweet in xmlTweets.Descendants("status")
select new TwitterItem{ ImageSource= tweet.Element("user").Element("profile_image_url").Value, Message=tweet.Element("text").Value};
}
private void button2_Click(object sender, RoutedEventArgse)
{
WebClienttwitter = new WebClient();
// Handle downloaded data when finished
twitter.DownloadStringCompleted+= new DownloadStringCompletedEventHandler(twitter_DownloadStringCompleted);
// Set the site
twitter.DownloadStringAsync(new Uri("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=" + textBox1.Text));
}
69. Binding, Templates and XML Example
void twitter_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgse)
{
if (e.Error!= null) return;
XElementxmlTweets= XElement.Parse(e.Result);
lstTwitter.ItemsSource=
from tweet in xmlTweets.Descendants("status")
select new TwitterItem{ ImageSource= tweet.Element("user").Element("profile_image_url").Value, Message=tweet.Element("text").Value};
}
private void button2_Click(object sender, RoutedEventArgse)
{
WebClienttwitter = new WebClient();
// Handle downloaded data when finished
twitter.DownloadStringCompleted+= new DownloadStringCompletedEventHandler(twitter_DownloadStringCompleted);
// Set the site
twitter.DownloadStringAsync(new Uri("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=" + textBox1.Text));
}
70. Binding, Templates and XML Example
void twitter_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgse)
{
if (e.Error!= null) return;
XElementxmlTweets= XElement.Parse(e.Result);
lstTwitter.ItemsSource=
from tweet in xmlTweets.Descendants("status")
select new TwitterItem{ ImageSource= tweet.Element("user").Element("profile_image_url").Value, Message=tweet.Element("text").Value};
}
private void button2_Click(object sender, RoutedEventArgse)
{
WebClienttwitter = new WebClient();
// Handle downloaded data when finished
twitter.DownloadStringCompleted+= new DownloadStringCompletedEventHandler(twitter_DownloadStringCompleted);
// Set the site
twitter.DownloadStringAsync(new Uri("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=" + textBox1.Text));
}
71. Binding, Templates and XML Example
void twitter_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgse)
{
if (e.Error!= null) return;
XElementxmlTweets= XElement.Parse(e.Result);
lstTwitter.ItemsSource=
from tweet in xmlTweets.Descendants("status")
select new TwitterItem{ ImageSource= tweet.Element("user").Element("profile_image_url").Value, Message=tweet.Element("text").Value};
}
private void button2_Click(object sender, RoutedEventArgse)
{
WebClienttwitter = new WebClient();
// Handle downloaded data when finished
twitter.DownloadStringCompleted+= new DownloadStringCompletedEventHandler(twitter_DownloadStringCompleted);
// Set the site
twitter.DownloadStringAsync(new Uri("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=" + textBox1.Text));
}