Category: WPF

Pictures in the Cloud – SSDS demo app

I’ve been playing around with SQL Server Data Services, Microsoft’s new concept for the ‘datacenter in the cloud’.

Anyhow, I’ve been having a bit of hack around to show how pictures can be stored by this kind of service. There isn’t any reason to use this over the other online photo sharing sites, but it demonstrates how to use the API.

http://www.codeplex.com/CloudPictures

As far as I can tell, there are no ‘best practices’ about how to use SSDS (probably because no one is publicly using it for the enterprise yet). Hopefully writing this application will show me the best way to achieve this.

There isn’t a ‘release’ yet, but if you download the source, build it (VS 2008) get a username and password and edit the app.config then it should work straight away.

Alpha Blended Windows Mobile Controls

Although WPF would be cool on the mobile device, the reality is that there isn’t really enough power for that. Silverlight support is coming, but it was previewed mid-2007 and only press releases since..

In the meantime, yet another CodePlex project to get you that UI 🙂

Project Description
AlphaMobileControls is a .NET Compact Framework 2.0 API offering WinForm Controls for Windows Mobile 5 or 6 able to handle images with alpha channel and alpha blending.

http://www.codeplex.com/alphamobilecontrols

OMG! MFC Lives!!!

I started off my career writing apps and controls in C++ with the MFC library.. despite what many say, I found it gave flexibility that Visual Basic could not, and allowed you to build a complex GUI with relative ease.

Considering that even WinForms looks obsolete with the advent of WPF, it is good to see that Microsoft have not abandoned MFC, but have in fact updated it!

http://www.microsoft.com/downloads/details.aspx?FamilyId=D466226B-8DAB-445F-A7B4-448B326C48E7&displaylang=en

I personally have no compelling reason to go back to MFC… WPF has sold me totally. But with so much legacy code out there, it isn’t unfeasible to get involved again in future…

WPF Part 2 – Using a Grid Control

UPDATE: 04/24/2009

After a year this still gets a few views! I’ve updated the code to make it look better.

____________________________________________________________________

UPDATE: 12/21/2007

Hello Channel9 ppl 🙂

I have no idea why this article has got into a debate about web design!

Anyway, this is not about a complete user interface. I might address complex user interfaces later, but frankly my origional ‘pain point’ was lack of a simple Grid demo in WPF.

Please don’t read this as more than it is supposed to be ^_^

____________________________________________________________________

In Part 1, I discussed the need for a compelling front end to your demonstration.

Here is my first concept.. just some basic WinForms UI elements required for the job at hand.

Winforms Look n’ feel

I was happy to see this work because I knew the WCF communication code behind, and I saw this as a manifestation of that. 

However, would you show this to a customer?

Hence, I decided to go with a WPF frontend for my next iteration:
WPF Aero Look n’ feel

It still needs some work to go to become a good ‘User Interface’, but this already is 100% better on the eyes.

Doc with XAML code embedded

To give you an idea how easy it is, here is the XAML code I defined to add a progress bar to the Infragistics Grid Control above:


<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
	<ProgressBar Minimum="0" Maximum="100" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}" ToolTip="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}" MaxHeight="20"/>
</Grid>

And here is another snippet, showing how to add a button, with a click event:


<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
	<Button Height="26" Width="26" Tag="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}" ToolTip="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}" Click="Button_Click">
		<Image Source="D:\Projects\avasmall.png"/>
	</Button>
</Grid></code>

This was all done in the newly released Visual Studio 2008.

Get into WPF – Part 1

Wouldn’t it be great if you could create a nice WCF Services demo, and everyone loved it?

Well, that is the problem.. I wanted a spartan interface because I wanted to show off the services and NOT the UI.

Nevertheless after to showing to a few people, I realised that the ‘plain’ Windows Forms client actually put people off. An attractive UI, although irrelevant to my goal of showing a services demo, actually has the effect of making people more interested.

Hence I wanted something to look good, and I thought I would give WPF a shot. As a learning curve, it was actually pretty easy to get into, especially if you are used to putting together ASP.NET web pages.

The important thing is creating a good XAML structure, which is given equal prominence to the GUI design window. I’m sure VB developers will hate this, but frankly the source to me is a great deal cleaner than the way it used to be done. In the past, if I made a mistake in the generated Visual C++ MFC or the C# Win-Forms code, quite often it would be easier to throw the form away and start from scratch.

Anyway I’m lazy… I could spend a week going through WPF tutorials, or I could dive right in. I discovered that Infragistics have a free Grid control for WPF:

http://www.infragistics.com/dotnet/netadvantage/wpf/xamdatagrid.aspx#Overview

And that Derek Harmon had a good example program about how to configure some controls inside it:

http://blogs.infragistics.com/blogs/derekh/archive/2007/04/30/graphically-present-cell-values-in-netadvantage-for-wpf.aspx

It took me about an hour to be a WPF data grid designer 🙂

Later this week I’ll show the steps required to make the Infragistics Datagrid with custom controls