Presenting at VB Central

Next week, on march 10th, I will be doing a presentation on getting started with WCF at the VB Central user group in the Netherlands. Its a free event so if you are in the neighborhood feel free to drop by. They do ask you register beforehand. Besides my session on WCF there will also be a session on using WPF and data binding. Mode details and the registration page can be found here. Hope to see you there. [f1] [f2]

Patterns & Practices release Prism version 2

The Patterns & Practices group at Microsoft have just released Prism version 2. I am pretty exited about this because Prism version 2 supports both WPF and Silverlight. And as it makes extensive use of the Model – View – ViewModel amongst other design patterns it is a great place to learn, even if you don’t use it as is. Check out the main “Composite Application Guidance for WPF and Silverlight” page here. Or read Blaine Wastell about it here. Enjoy!

Data validation – Silverlight versus WPF part 2

In a previous blog post I pointed out that quite a difference between data validation between Silverlight and WFP. As I don’t think adding data validation in the UI is a good thing I focused on validation in the business object by throwing an exception when the value was not acceptable. As Beth pointed out WPF also supports the IDataErrorInfo interface as she demonstrates here. I think using the IDataErrorInfo interface is superior to throwing exceptions. After all exceptions should be exceptional and users entering invalid data in real applications is not very exceptional  [:(]. However Silverlight only contains a … Continue reading Data validation – Silverlight versus WPF part 2

How to know when the DataContext changed in your control

The DataContext is a wonderful property, you can set it somewhere in the logical tree and any child control can just bind to properties without having to know where the DataContext was set. A great capability that makes live much simpler when writing XAML. But sometimes when building a control of some sorts you just need to know when the DataContext has changed. For example when binding to events on whatever object is set as the current DataContext. Take for example the following simple form. In this form I am data bound to a real simple Person object which implements … Continue reading How to know when the DataContext changed in your control

Data validation – Silverlight versus WPF

When I am creating business applications validating the data in business objects, and displaying any errors, is always a big deal. Even though WPF and Silverlight both use XAML and support data binding the default way to display errors is quite different. Now I am focusing on validation in the business object here even though WPF has additional capabilities of validating input in the XAML using ValidationRules. While there might be some good reason to validate data directly in the UI in some cases I find it a requirement to validate data inside a business object so the validation is … Continue reading Data validation – Silverlight versus WPF

WrapPanel in ListBox revisited

Last week logged about using a WrapPanel in a listBox and demonstrated how to get the content to wrap around, read about it here. Turns out the XAML can be even easier. In the previous post I used a ControlTemplate with a Grid to stop the WrapPanel from just expanding horizontally. Turns out there us an even easier way to do so by disabling the horizontal scrollbar using the ListBox ScrollViewer. The following XAML will do the trick just fine: <UserControl xmlns:controls="clr-namespace:Microsoft.Windows.Controls;assembly=Microsoft.Windows.Controls" x:Class="SilverlightApplication4.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="400" Height="300"> <Grid x:Name="LayoutRoot" Background="White"> <ListBox x:Name="DemoList" ScrollViewer.HorizontalScrollBarVisibility="Disabled"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <controls:WrapPanel /> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate> … Continue reading WrapPanel in ListBox revisited

Unit testing in Silverlight part 2

Part 1 Part 2 Part 3 Part 4 In my previous post I described the basic setup of unit testing in Silverlight, you can read all about it here. The basics where very nice but lots of code we write in Silverlight has to do with networking and in Silverlight that means asynchronous code, something that is always hard to test! Because, just I like using Flickr, lets download some pictures and see what it takes to make that testable. Below is the very simple application we need to unit test, basically a list of pictures from my Flickr photo … Continue reading Unit testing in Silverlight part 2

PDC session download

Want to download and watch all PDC content? Then there are a couple of ways to get at them. The official way if to go through the session agenda at the conference site. See https://sessions.microsoftpdc.com/public/timeline.aspx. You see all sessions but it takes a bit of work. Another nice way is through Channel 9 by using the following feed: http://channel9.msdn.com/posts/pdc2008/RSS/?tag=videos. But the best as far as I am concerned is using the list compiled by Greg Duncan. Check this list http://coolthingoftheday.blogspot.com/2008/10/pdc2008-quick-video-link-list.html. And it even has the Visual Basic source code used to generate the list [:)] Enjoy the videos! [f1][f2]

Using the ReplicatorActivity in Parallel mode

I have heard quite a few times that the ReplicatorActivity can only be use in parallel mode with a custom activity. The reason being that you need an extra property to store the current child data. When the ReplicatorActivity works in sequential mode the following code works just fine: private void codeActivity1_ExecuteCode(object sender, EventArgs e) { int value = (int)replicatorActivity1.CurrentChildData[replicatorActivity1.CurrentIndex]; Console.WriteLine(“Loop value = {0}”, value); } However when run in parallel the current index always point to the last item so this doesn’t work. As an aside I think this is a bug as it results in hard to find … Continue reading Using the ReplicatorActivity in Parallel mode

Red Gate to continue development of .NET Reflector

.NET Reflector, by Lutz Roeder, must be one of the most useful tools I have when developing .NET code. Usually it is the first thing I install right after Visual Studio not even waiting until I need it because I know I will. So the big news is that Red Gate, makers of the Ants profiler and lots of other tools, are taking over from Lutz Roeder and will continue developing .NET Reflector. Interesting move and I hope this means a bright future for the .NET Reflector. Read more about this here.   Enjoy!   [f1][f2]