Monday, 14 February 2011

Prism 4.0 learnings

I have started to plan to use Prism 4.0 in one of my organisations internal applications. Previously I created a shell application and several modules that implement a standard interface. Having looked at Prism, much of this is already done via the templates that are available.

I'll post some thoughts, problems and examples when I have something concrete.

Monday, 10 January 2011

Extended ListView WPF Custom Control (Part 1)

I am trying to write a WPF control that can be used in my projects to provide a standardised look and feel for data that is presented via grids. I'll put my thoughts down here, as a aid to my fading memory.

First I'll create the control, descended from ContentControl (as it will contain further content)

namespace Controls
{
using System;
using System.Windows.Controls;
using System.Windows;
using System.Windows.Input;
using System.ComponentModel;

public class ListViewExtended : ContentControl
{
static ListViewExtended()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ListViewExtended),
new FrameworkPropertyMetadata(typeof(ListViewExtended)));
}
}
}


This is really simple, and is a standard setup, next the difficult bit is creating the correct XAML template, this looks (in the initial version anyway), like this:





This can be used as follows:















I'll tidy this up and add a screenshot later, and then extend the example to show it doing what I want it actually to do in the next post