Category Archives: WPF

Couple of methods missing on ObservableCollection

Here are a couple of methods that are missing on ObservableCollection<T>: public static class ObservableCollectionExtensions { public static void AddRange<T>(this ObservableCollection<T> observableCollection, IEnumerable<T> elements) { foreach (var element in elements) observableCollection.Add(element); } public static ObservableCollection<T> Create<T>(IEnumerable<T> elements) { var observableCollection … Continue reading

Posted in C#, Silverlight, WPF | Leave a comment

Exploring graphical programming with Blend, Visual State Manager and Behaviors

A while ago i presented the ControlStateMachine and in Silverlight this concept is implemented as the Visual State Manager. In my sokoban implementation i have a cellview which exists out of 6 canvasses but only two of them (one for … Continue reading

Posted in Silverlight, WPF | Leave a comment

ViewModel to translate domain messages to view events

Here is an example of a ViewModel that translates domain messages to view events: class GameViewModel : INotifyPropertyChanged, IListener<BoardChanged> { public event PropertyChangedEventHandler PropertyChanged = delegate { }; public GameViewModel() { var messageBus = ServiceLocator.MessageBus; messageBus.Subscribe<BoardChanged>(this); } void IListener<BoardChanged>.Handle(BoardChanged message) … Continue reading

Posted in C#, Silverlight, WPF | Leave a comment

About databinding and composite views

A couple of days ago i had a databound ItemsControl (collection of Model.Cell) which instantiated sub views (with their own viewmodel). <Grid.Resources> <DataTemplate x:Key="CellTemplate"> <views:CellView /> </DataTemplate> </Grid.Resources> <ItemsControl ItemTemplate="{StaticResource CellTemplate}" ItemsSource="{Binding Cells}" /> </Grid> Because each CellViewModel needs to … Continue reading

Posted in Patterns, Silverlight, WPF | Leave a comment

Exploring M-V-VM

A couple of years ago a collegue recommended Data Binding with Windows Forms 2.0: Programming Smart Client Data Applications with .NET and i noticed that my code started to gravitate towards an Model-View-ViewModel architecture. Due to shortcomings and painful experiences … Continue reading

Posted in Patterns, Silverlight, WPF | Leave a comment

Sokoban: Creating graphics with Expression Design

Earlier this morning i decided to improve the graphics the little. I launched Expression Design, created a new image, and drew each possible cell and piece in a seperate layer. With this technique i can easily preview how a “Box” … Continue reading

Posted in Silverlight, WPF | 4 Comments

Silverlight wishlist

Here are the features that i would love to see in Silverlight: Allow users to copy text from the UI (Or was the UX argument an excuse for playing with new toys?) MSTEST (I know that Silverlight Unit Test Framework … Continue reading

Posted in Silverlight, WPF | Leave a comment

About Expression Blend

At first i developed most WPF interfaces by writing XAML in the code view of Visual Studio. Those days are gone These days i find it a lot easier to use Expression Blend (eg: paths, animations and timelines) but i … Continue reading

Posted in WPF | Leave a comment