« Posts tagged c#

Define some items in a ListBox as unselectable

It seems to be a quite common problem that one does not know how to set one or more items in a ListBox to unselectable or disabled.

The same principle as described here can also be user for similar problems like setting a different background color for some items.

First we’re going to create a simple domain class with a property that describes if the item should be selectable or not.

public class MyDataObject {
    public string Name { get; set; }
    public bool IsSelectable { get; set; }
}

»Read More

An easy way to revert changes in Object data

A quite common problem in an MVC GUI is the need to revert changes in the model made by the user. Let’s say you create a UI where the user can modify some fields that are bound to a model object. After the user already did some changes, he recognizes that he entered some wrong data and wants to cancel the editing. So what now? The data is already written into the model.

The easiest way to revert this changes is obviously to let the user work with a copy of the real data object. So let’s add a clone method to the model and mark it as Serializable. »Read More

Access a Zend Rest Service from C#

Accessing a Restful service is actually no big deal, but it took me quite a while to figure out some details. So here’s a short description of it.
»Read More