In Windows Forms, I have created a Twitter application that gets the latest tweets from the Timeline using TweetSharp. I have used a UserControl and a Panel to display these. The code I’ve used to do this looks like this:
IEnumerable<TwitterStatus> tweets = service.ListTweetsOnHomeTimeline();
foreach (var tweet in tweets)
{
TweetBox t = new TweetBox();
t.username.Text = tweet.User.ScreenName; // Label
t.display.ImageLocation = tweet.User.ProfileImageUrl; // PictureBox
t.tweet.Text = tweet.Text; // Label
t.info.Text = tweet.CreatedDate.ToString();
t.Dock = DockStyle.Top;
HomeTimeline.Controls.Add(t); // Add to HomeTimeline Panel
}
I’m now re-making this application in WPF. The UserControl is in the same format, but I’m clueless as of how to add this to the panel and dock it to the top – or the equivalent in WPF. How do I do this?
A WinForms UserControl are not the same as a WPF UserControl.
You’ll have to make the UserControl again, in WPF.
Of course, you could wrap the WinForms UserControl in a
WindowsFormsHostelement, but that’s not good practice.