vrijdag 4 december 2009

A Generic Dialog ViewModel

Introduction

A few months ago I worked on a wpf viewmodel for dialogs, because it seemed strange to me that you needed for instance windows forms dialogs to open or save files in wpf. So I set about creating my own wpf dialogs. After creating the dialog viewmodels there still remained a small issue with the library and also I didn't have much time to write an article about it. I however published the library containing the viewmodels for dialogs with another article on my blog. Someone saw the viewmodel in this library and asked if I could write about it. I had a good look at the code again and solved the small problem and so here's the article. I remembered looking for a nice viewmodel for dialogs a few months ago but couldn't find any. In the mean time since I wrote the viewmodel Sacha Barber published his Cinch framework. Part 3 of his series on the codeproject site describes a dialog service. My solution looks quite different so I hope you find this article still interesting.
Shout it kick it on DotNetKicks.com

dinsdag 15 september 2009

Freeing the axes of the Microsoft toolkit charting control

Introduction

Most charting tools produce the same kind of charts. A chart has a vertical axis on the left (or right) and a horizontal axis on the bottom (or top). You can add more axes but they are stuck to the sides of the chart and keep occupying the whole length of the chart area. In medical applications we want to have charts like the one below. For the interested: The first five signals are EEG signals, (the electrical activity in the brain). Below the EEG signals are the patients breathing signal, the blood pressure and the heartbeat (ECG) signal.
Eeg

Shout it kick it on DotNetKicks.com

vrijdag 10 juli 2009

A viewmodel for the fluidkit transition control

I was trying to create a program that has several pages with only one page visible at a time. If you want to see another page you should press a button with the name of that page.
The first thing I tried was using a TabControl. The problem with the TabControl was that each time you left a page the page would be unloaded. This is not the behaviour I wanted. The pages should stay in memory even when they aren’t visible. I searched for a solution and found this blog entry that described an extension to the tabcontrol called TabControlEx. I tried it out and indeed the items in the tab stayed in memory, but I couldn’t get it to work the way I wanted it.
Then I remembered the fluidkit library created by Pavan Podila. This library has a class called TransitionPresenter that derives from ItemsControl. You can make a slideshow with the items you add to this control. The items you add stay in memory when they aren’t shown on screen. Because I always try to write my programs with the MVVM pattern I looked for a viewmodel for this class. I found a blog entry by Jeremy Alles who extended the TransitionPresenter and created a viewmodel for his newly created class. The strange thing was that his new class loaded the visible pages and unloaded the invisible pages. I tried to change this behaviour in his class but couldn’t figure out what happened and gave up.

Shout it kick it on DotNetKicks.com

donderdag 4 juni 2009

A Viewmodel for the ObservableCollection

Introduction

In my previous post I wrote about the MasterDetailViewModel. A viewmodel for the navigation of master-detail tables. I briefly mentioned you could extend its base class, the NavigationViewModel class, and create a viewmodel for an ObservableCollection. In this post I will describe such a viewmodel that I called the ObservableViewModel, and give an example of its usage. Because the ObservableViewModel shared a lot of functionality with the MasterDetailViewModel an intermediate viewmodel called CollectionViewModel is needed. The class diagram of the viewmodels now looks like the figure below: image
Shout it kick it on DotNetKicks.com

vrijdag 24 april 2009

A Master-Detail ViewModel

Introduction

A while ago I attempted to write a Master/Detail viewmodel . The result you can find here. This article was a reaction on a video Beth Massi showed here. It’s a very nice tutorial on how to create a master-detail data entry form in WPF. However you have to type quite a lot of code each time you want to create your master-detail forms. So I thought I should write a viewmodel that does most of the work. My first attempt worked pretty good but since then I read some wonderful WPF articles like this one of Josh Smith. In it he describes some viewmodels that can be used as base classes for my own viewmodels.

Shout it kick it on DotNetKicks.com

woensdag 3 december 2008

My version of Jason Dollinger's demonstration code

I saw this post. It refers to a video where Jason Dollinger creates a small program with the help of a pattern called model-view-viewmodel (m-v-vm). Some people wrote in the comments to this post that they wanted the source code of the program that was created in this video. I thought it would be nice to recreate the program as a way of learning about this pattern. After I wrote it I thought it would be nice to share it with you. I haven't implemented the unity framework yet. But I already have used the MEF library in other programs. So I probably will write an update of this program in the future where the MEF framework is used. Because I wrote the program in Visual Studio Express no unit testing is included. You can download the file here. If you have any comments or suggestions please let me know! Shout it kick it on DotNetKicks.com

maandag 1 december 2008

Creating a master/detail viewmodel

UPDATE 4-6-2009: An article about the latest version of this program can be found here. The viewmodel described in this article has changed a lot.


I'm just starting with wpf and I read Beth Massi's code that belonged to this video. It's about creating a master/detail view in wpf. I also saw Jason Dollingers's video about creating a viewmodel: Jason Dolinger on Model-View-ViewModel I though I could give this viewmodel thing a try using as a starting point Beth Massi's code.

Shout it kick it on DotNetKicks.com