WPF Grid splitters

Addin splitters to the WPF grid couldn't be easier.


<GridSplitter />


<GridSplitter Height="3"
   ResizeDirection="Rows" Background="Transparent"
   VerticalAlignment="Stretch" Grid.Row="1" />

WPF Routed events

Ever have a control on a window and want to be able to receive button clicks from this child control?
More than one I've done this the hard way, but now.....



public VariablesWindow()
   variables.AddHandler(Button.ClickEvent, new RoutedEventHandler(HandleChildClick));
  private void HandleChildClick(object sender, RoutedEventArgs args)
            Button senderButton = args.OriginalSource as Button;
            if (senderButton != null && senderButton.Content != null)
                string buttonText = senderButton.Content as string;
                if (buttonText == "_Cancel")
                    this.DialogResult = false;
                else if (buttonText == "_OK")
                    this.DialogResult = true;


Key modifiers

Recently I used PInvoke to check if the SHIFT key was pressed while i was doing a drag operation......

what I should have done then and have done now is



if((Keyboard.Modifiers & ModifierKeys.Shift) != ModifierKeys.None)
  Trace.WriteLine("Shift is pressed");


A Custom Diagramming Library

Recently I've been working with a 3rd party diagramming library written in windows forms. It's been great and it's pretty fast in building 80% of the application I'm working on.

[Update August 2012: I never got around to doing much with the diagramming library. I opted instead to re-host the visual studio workflow designer for my needs, why I actually considered writing it is beyond me, I’m a campaigner for bolting existing solutions together rather than re-inventing the wheel ]

WPF Data Triggers

Today I needed to control the enabled property of a button "Remove Item" on my form depending on weather there was a selected item in a Listbox.

Here's how

<Button Content="Remove" Click="OnRemoveTranstion">
        <DataTrigger Binding ="{Binding ElementName=listDetails, Path=SelectedIndex}" Value="-1">
            <Setter Property="Button.IsEnabled" Value="false"/>

Converting your VS2008 projects to support xaml designer in Expression blend 3

If you've created a new WPF project in VS2008 and then you try to design your UX in Expression Blend 3 you'll find that you get xaml view only.

What is required is to add


to the project file.

.NET DateTime Webservices UTC

With .NET 1.1 when we receive a UTC DateTime in a SOAP response from a Webservice it used to get converted to Local time.

With .NET 2.0 when we receive a UTC DateTime in a SOAP response it stays in UTC.

If you need it in local time make sure to call .ToLocalTime()

** Edit: P.s. Have a look at this neat class in the framework XmlConvert

Expression blend for WPF/Silverlight 4

Announced at PDC this week


Finally a version of blend that will open vs2010 projects (and of course handle Wpf4 and Silverlight 4)

It will run side by side with Blend 3

Enjoy Winking smile

Configuring IIS to host WCF services

It's true what they say, to learn new technologies it's simple a matter of ABC (Always be coding), I've watched many the video, read many the book but it's only when I went to try to do something the it sinks in.
Like tonight while trying to host a WCF service on my Windows 7 machine I came across a problem that you'd only find by ABC.

HTTP Error 404.3 - Not Found

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

The solution.

Control Panel/Programs and Features/Add or Remove components/Microsoft .NET Framework 3.5.1 section.

I checked the two Windows Communication Foundation checkboxes shown below (the second box enables Windows Activation Service - WAS so that IIS can host WCF services that can be called using non-HTTP bindings such as TCP) (nice!)


WPF ErrorList



I recently wrote a control that tries to replicate the error list seen in Visual studio.

The control is dependant on .NET 3.5 SP1. because it uses the WPFToolkit.

I'm hosting a sample here. [Update August 2012 My host has stopped xbap application types, sorry]


Recent Tweets

Note: For Customization and Configuration, CheckOut Recent Tweets Documentation


<<  March 2018  >>

View posts in large calendar

Month List