SilverTweet – Building a Silverlight Twitter client part 5

I’m finally back after a couple of weeks with too much stuff to do. It is definitely time to finish off the blog series about SilverTweet, the Silverlight twitter client that you can build on your own. Hopefully you can then take this thing and extend it with the features you need.

For those of you who haven’t read the previous parts, I would recommend doing so. Otherwise, this part will give you just about nothing valuable. And for those of you who have, and did so before I posted this part, I just want to mention that I found a pretty obvious bug in part 3.

The example code in this post will create a functional, but fugly UI. The downloadable code will contain this UI, as well as an extra UI with better layout, some animations and so on. The reason for the fugly UI here is simplicity. Not that the other UI is REALLY beautiful, but it is at least a lot better…

But let’s just get started straight away and have a look at the UI that we need to start using the application.

More...

The application from the Wellington Silverlight User Group

Hi! For those of you who attended the Silverlight User Group meeting yesterday, and saw my presentation on data bindings in Silverlight, here is the sample application zipped up and ready. For those of you who have no clue what I am talking about, and instead wonder where the last part of the Twitter client is, I’m sorry! I have been up to my eyeballs in stuff lately… Work, presentations at the Wellington Web Meetup and the Wellington Silverlight User Group and so on. I promise I will try to get it online as soon as possible. Hopefully early next week…

But here is the code at least…DataBindingDemo.zip (369.84 kb)

Hmm…that file got grossly bloated…sorry about that. It just has a bunch of compilation crap in it…but hey…bandwidth is free…ohh…that’s right, I’m in New Zealand where you for some !£$%@# don’t have flat rates on broadband…

Oh…and I forgot…the cool framework I was talking about is here

The CommandManager take 3…

[UPDATE]
The code for the CommandManager has been rewritten due to some memory management issues. And together with that change, I have decided to put it on Codeplex. My blog posts about it are still more or less valid, but I suggest also taking a look at the code at http://agcommandmanager.codeplex.com/.
[/UPDATE]

Once again I return to the CommandManager that I have blogged about before. And I know it is getting boring and that I some day must leave that behind me and go forward. However, after having had a look at Prism/CAG/CAL and seen how Microsoft solves the commanding infrastructure, I have decided that the CommandManager still fills a purpose.

I also had a plan to retire the CommandManager completely and implement something similar using Behaviors. However, Behavior<T> or what ever it is called, inherits directly from DependencyObject instead of from FrameworkElement. This made it really hard to use in this situation, since it doesn’t support data binding. So I had to scrap that idea for now. It seems as if Microsoft uses this idea in Prism, but introduces an extra static object to get it to work… At least in the Prism implementation I have been looking at.

So why do I return to the CommandManager again? Just to argue that it is great and boost my ego? No…apparently, my previous implementation had a flaw. I might have a lot more, but I discovered one that caused problems. So I have rectified that…

More...

Adding some style to the loading screen…

There is a simple little feature available in Silverlight that I think everyone should use, or at least more or less everyone. It is the possibility of adding a custom loading screen that will be shown while the plug-in downloads the Xap. It is simple to implement and gives your application that little extra to make it stand out. If you look at Flash for example, you will see that every Flash application has its own loading screen. During the time that the application downloads, you can display how much has been downloaded, but you can also give the user something to look at or even do. My favorite loaders the ones that gives you a simple game to play with while the application loads. This however, is only useful if the application is really big. And in that case, I would recommend splitting up the application in smaller pieces and load them on demand. Anyhow, how do we do it?

More...

Adding transitions when changing DataContext

I have several times gotten in a discussion regarding the visual aspects around changing the DataContext. That sounds like a really interesting discussion, doesn’t it…? Well, why is it a discussion at all, why is it something that I even bother writing about (just wait until you see the amount of code I have written as well)? Well…as you might have noticed in my previous posts, data bindings are very central in Silverlight development. At least if you do it like I do it. And that means that we work quite a lot with the DataContext of different controls. And out of the box, changing the DataContext will update all the binding, which is exactly what we want. But what happens when we DON’T want the change to be instantaneous? What if we want to add some form of transition? Well…as far as I know, you are %$@ out of luck. That is why I decided to try and build something that can do it for us…in a nice re-usable package…

More...

Bindings, the glue that connects the view to the viewmodel part 2 (and apparently a bunch of data validation information)

Welcome back! Or possible Welcome! Sort of depends on if you saw my previous post… Anyhow, you have probably figured out that it is time to go on with even more binding information. In the previous we looked at the basic binding syntax and functionality. So, what’s left? Well, a bunch of small, medium and large details…

More...

Bindings, the glue that connects the view to the viewmodel part 1

If you have read anything I have written in the past, you are probably familiar with the fact that I am a huge fan of MVVM. There will have to be a lot of convincing before anyone gets me to switch pattern when working with Silverlight. There are several things one must learn and understand before one can use MVVM well.

There is the obvious part of learning the actual pattern and how it works. Learning how to build a good viewmodel, which is dependent on the data model and time and other circumstances. I know that there are a lot of people out there, especially bloggers, that will tell you that you have to build something according to this or that and be a true purist to be a good developer. However, a lot of these people forget that most of us do actually have clients that don’t feel like spending 2 months or $10.000 just to get it to be a perfect solution. In most cases one must adhere to this and make the best of the situation.

More...

www.office2010themovie.com is now live

The last week and a half, I have together with a handful of people at Intergen, built a new Silverlight site for Microsoft. I call it a Silverlight site instead of a Silverlight application, since it is actually an entire site. We created the whole experience inside Silverlight instead of having Silverlight “islands” on AJAX/HTML page. The project has been intense and fun. It is kind of interesting to see how much you can get done in such a short timeframe.

On Thursday the 2nd we had more or less nothing but a few line drawings from our design guy Dave. At the end of Friday, we had a skeleton, that is a more or less fully functional site without any layout. ListBoxes on a white page just showing that the data was coming from over the wire from our WPF services.

More...

Adding mouse wheel scrolling in Silverlight

I have just gone through a project that used mouse wheel scrolling of different elements in the application. There are probably a LOT of different ways of doing this, and this is absolutely not something new. But I wanted to make the solution re-usable by using attached properties.

The only issue with handling the scroll wheel is that Silverlight doesn’t support that, and does not expose an event for that. So you have to roll your own. This is not hard to do. All you have to do is handle the mouse wheel events from the browser using the JavaScript bridge.

On a side note, I did actually find this blog that talks about using UI Automation to handle the scrolling instead. Even though this seems like a cool solution, I was too far down the other line to turn back. So my solution is using the traditional JavaScript way…

More...

The MouseOver state visuals are reset by the Pressed even if I haven’t told it to

I’ve recently come up with a thing that is probably old news for most people. But to me it was new. I have styled a bunch of things lately, among them a bunch of buttons. Most of the buttons had MouserOver states, but no Pressed state. So I changed the template of the buttons and added my VisualStateManager (VSM from now on).

Being lazy as I am, I opened up generic.xaml and stole the original style for the button. And no, I did not use Blend! Why not? Probably because I’m a stubborn meticulous person who like coding things on my own…

More...