Posts tonen met het label c#. Alle posts tonen
Posts tonen met het label c#. Alle posts tonen
dinsdag 15 september 2009
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.
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.
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: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.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!
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.
Abonneren op:
Posts (Atom)