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...

Playing Smooth Streaming (.ism) videos in Silverlight…

I’m currently working on this Silverlight project, that will be a growing video archive that you might see go online in the close future. Unfortunately I can’t say more at the moment. But that is not what this post is about. The post is about playing Smooth Streaming videos in Silverlight.

I’m not that familiar with media streaming and video formats and so on, but when we started talking about playing video, I insisted on it being streaming. Http progressive download is just not that attractive and great… It will use up unnecessary bandwidth as well as cause certain “issues” at the client. Such as limiting the users ability to “scrub” though the video…

More...

Changing the layout for the selected item in ListBox

I’m currently working on a Silverlight 2 application that will go on-line in about a week. It is not a big application, at least not if you look at the functionality in it, but it still has it’s challenges. Especially graphical ones. But this was one that I didn’t actually expect would cause a problem…

Our designer has worked up some nice layout that we need to implement. One of the features in the layout is a list of items that the user can select from. Obviously a ListBox. But the thing that caused problems, was the fact that it was supposed to show a compact information layout for all items except the selected item. The selected item should have a more verbose layout and some extra functionality. Initially that seemed like a tiny problem. That would just be a ItemTemplate with a VisualStateManager. Apparently not…!

More...

Silverlight 3 - MergedDictionaries

After having worked a while with Silverlight you realize that you often keep a lot of things in resources in your Xaml. Not only do you add Storyboards for your animations, but you often also add styles and templates, and some converters and so on. The resources all of the sudden start taking up most if the rows in your Xaml. It becomes hard to read. Especially since Silverlight is all about styling and templating controls, which results in large amounts of Xaml.

It is also hard to share resources. Say that you have these converters that you use in several of your controls. How do you solve that? Having them declared in multiple places is no good.

In Silverlight 2 there wasn’t much you could do. You would just have to have all of those resources in your Xaml, and if you wanted to share them, they had to be in the App.xaml file.

More...

And then Firefox does it differently…reloading the Silverlight control when the css changes…

I’ve, as you maybe know, been working on a Silverlight flickr viewer for my fiancées blog. And now that I have finally got it all done, blogged about it and so on, it was time to actually implement it on her blog. So I took the code from my blog posts and built my services and view models, but tore out the entire view layer and replaced it with a somewhat prettier thing. It has a thumbnail view that is visible in her blog posts. It looks as small Polaroid photos scattered on her page. And then when you click one of them, it changes to a full screen view and shows a larger Polaroid picture with the pictures description an handwriting.

More...

flickrVIEWR – A flickr viewer in Silverlight – Part 3

I guess it is time to tie it all together and get the UI up and running for the flickrVIEWR. As you will notice, having built the viewmodels, the code for the UI is actually very simple. And the cool part is that there is no code in code behind at all.

But before I start creating the Xaml for the application, I’m going to hook up the viewmodel to the page and do a few little bits and pieces needed to get it all working.

More...

MVVM and animations…

Right now I am working on a Silverlight project for my company. In that project, as in most projects with Silverlight I need to run some animations. And since I’m working with MVVM this becomes a little cumbersome and complicated. I don’t want my view to be dependent on the viewmodel. So the view cant tell the model what storyboards to play. And I don’t want the viewmodel to be dependent on the view either. So i don’t want to give the viewmodel a referens to the view. I guess I could get some separation using interfaces, but it still felt a little off… So I thought a little about this, and then I Googled it. Do you know what I found when googling for “patterns mvvm animations”. Nothing really useful. A bunch of questions. I even tried to search for WPF and tried to leverage the WPF delelopers knowledge…no luck… So I had to figure something our myself. And I think I have actually found a pretty nice separation by using a Storyboard manager object.

More...

flickrVIEWR – A flickr viewer in Silverlight – Part 2

Hello again! It is time to go through the next phase in the development of the flickrVIEWR that I started a couple of days ago. The viewmodels. As usual I do build my Silverlight application using the MVVM pattern. I like this pattern a lot. Coming from an ASP.NET background, I think it offers a lot of nice features that I whish where available in general web development. I guess you do get some of the benefits and features by using MVC, but I have yet to try out doing that. And I will, I promise.

Anyhow…the viewmodels for the flickrVIEWR is not that complicated. Not at all. THhey have some small tricks up their sleeves, but nothing really cool. But before we get to the viewmodels I’m going to take a small detour via a service locator…

More...

flickrVIEWR – A flickr viewer in Silverlight – Part 1

I’m back! I’ve had my work up to my eyeballs the last couple of weeks. Apparently moving to the other side of the world and starting a new job takes a lot of time. So after that excuse, it is time to get started with my new project.

My fiancée has this blog where she blogs about our new life in NZ. And this is interesting to you because…? Well, it isn’t, but it is the reason for this blog post as well as a few more coming soon. On her blog, she posts pictures. These pictures are taken by her or me by a camera with several megapixels. That makes them too big for her blog. So she has to resize them before uploading them. This takes time and is annoying. So I offered to solve it in a somewhat more modern way. By using flickr. So she will upload her images to flickr and then use a little Silverlight application to show them on her blog. So that’s where this blog post is about…the flickrVIEWR…

More...

New Zealand and Intergen it is

I just wanted to explain why my blog has been completely quiet for a pretty long time until tonight. Me and my other half har just migrated from Stockholm (Sweden) to Wellington (New Zealand). I’ve started working at Intergen as a developer, which means that I get to be in the real world instead of just teaching like I have for the lest 2 years. So the move has taken up a lot of my time, and then when I got here, it  took about a month to get an apartment and the internet connection. So…that’s the reason…

More...