Category Archives: 13461

WPF/SL: lazy loading TreeView

01/26/2012: Code update Imagine the following scenario: you have a WCF service with two methods: List<Customer> GetCustomers(); List<Order> GetOrders(int CustomerId); You want a treeview with lazy loading in a WPF Window. There is many way to do it. I identify … Continue reading

Posted in 13461, 7671, 8708 | 2 Comments

SL5 with AsyncCtp: The type ‘System.Threading.Tasks.Task’ exists in both mscorlib.dll and AsyncCtpLibrary_Silverlight.dll

If you use AsyncCtp With SL5, you could have the following issue: The type ‘System.Threading.Tasks.Task’ exists in both mscorlib.dll and AsyncCtpLibrary_Silverlight.dll. So you can’t compile your project if you use Task class! In this case, you could use an alias … Continue reading

Posted in 13461, 16710 | 2 Comments

SL5: ICustomTypeProvider

We often have the following issue with SL4: in the Model we get a collection of entities and in the ViewModel, we want a collection of these entities but with VM intelligence (for example some calculated properties). In this case … Continue reading

Posted in 13461 | Leave a comment

WP7: an application to help people with language issues

I developed a Windows Phone Seven application to help people with language issues. This application is principally useful for concerned autistic people (like my son) but it can also be used for many handicap. You can look at the video … Continue reading

Posted in 13461, 14745, 7671 | Leave a comment

EnumerableCollection

Imagine the following scenario. You use MVVM, you have two classes on your model: public class Child{} public class Parent{    private ObservableCollection<Child> _children;    public ObservableCollection<Child> Children    {        get { return _children ?? (_children = new ObservableCollection<Child>()); }    }} You have two more classes on your ViewModel: public class ChildViewModel{    … Continue reading

Posted in 13461, 7671, 7672, 8708 | Leave a comment

INotifyPropertyChanged

When we want to use binding with WPF or SL, we use INotifyPropertyChanged interface most of time. This interface has only one member: event PropertyChangedEventHandler PropertyChanged; We generally use it like this: protected virtual void RaisePropertyChanged(string property){    if (PropertyChanged != null)        PropertyChanged(this, new PropertyChangedEventArgs(property));} … Continue reading

Posted in 13461, 7671, 8708 | Leave a comment

XAML: How to use a ConverterParameter which is not a string in XAML?

Imagine the following case: I have a TextBox and a TextBlock and a boolean property IsEditing. If IsEditing is true, the TextBox is visible and the TextBlock is hidden and reversely. In this case I could use a ViewModel with … Continue reading

Posted in 13461, 14489, 8708 | 4 Comments

ObservableCollection… better

ObservableCollection class is probably one of the worst classes I have ever seen in the .NET fx: Some current collection methods are missing: (AddRange for example) Bad for performance when we Refresh the collection (1 Clear + n Add) => … Continue reading

Posted in 13461, 7671, 7672, 8708 | 3 Comments