WPF

.NET source code?

Yeah, sure we all just use reflector anyway, but according to Scott Guthrie we'll be able to step into the source code of certain parts of the .NET framework with VS.NET 2008. "We'll begin by offering the source code (with source file comments included) for the .NET Base Class Libraries (System, System.IO, System.Collections, System.Configuration, System.Threading, System.Net, System.Security, System.Runtime, System.Text, etc), ASP.NET (System.Web), Windows Forms (System.Windows.Forms), ADO.NET (System.Data), XML (System.Xml), and WPF (System.Windows).  We'll then be adding more libraries in the months ahead (including WCF, Workflow, and LINQ).  The source code will be released under the Microsoft Reference License (MS-RL)." I can't even...

WPF Binding to RichTextBox.Document

I was getting some nice crashes on startup while trying to do some data binding to the Document property on RichTextBox under WPF and so I hit the net and found out that it's not possible. I quickly came up with the following code, which seems to work: class BindableRichTextBox : RichTextBox{    public static readonly DependencyProperty DocumentProperty = DependencyProperty.Register("Document", typeof(FlowDocument), typeof(BindableRichTextBox), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(OnDocumentChanged)));     public new FlowDocument Document    {        get { return (FlowDocument)GetValue(DocumentProperty); }        set { SetValue(DocumentProperty, value); }    }     static void OnDocumentChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)    {        RichTextBox rtb = (RichTextBox)obj;        rtb.Document = (FlowDocument)args.NewValue;    } }...

Shifting technology

By day I've been a Winforms programmer for the last few years, but over the last few weeks I've found myself branching out. The first was to do a project with WPF, and there's going to be a slight problem going back to winforms now because WPF is so much better. Time to rewrite the main app I think (kidding!). The second thing I've been doing is coding a website using ASP.NET. It's not something I've done much of before, and it's meant a lot of database work as well which is something I haven't really done for years...

A problem with WPF and Icons

I've run into a problem with WPF and icons. I got some made up by our graphic designer and he took the opportunity to do some proper Vista icons with high resolutions. I added the icon to my application and got an error. It turns out that although you can set the application icon to a file that has a compressed PNG version embedded, a WPF form cannot support there being compression in the icon. Most annoying. I got a version generated that just had an uncompressed PNG instead and that seems to work fine so it looks like...

Some serious Expression Blend suggestions

Here's a list of features I'd love to see added to expression blend: Maintain solution folders in the project view. Large solutions become a problem when you have loads of projects, especially when it means your unit test assemblies start to get mixed up with the application. Support the same path length as Visual Studio. I had a project fail to load in Blend that loads fine in VS.NET 2005 Don't make projects start as all expanded, or add a collapse all option. Make Expression Light the default theme, it looks a lot better than dark. I can't seem to...

How to annoy a graphic designer who wants to design a UI prototype

If you really want to annoy a graphic designer who wants to design a UI prototype for an application to show you what he's on about (and also to test that whole code behind UI design for WPF idea they took from ASP.NET) then give them a copy of Expression Blend. You'll be amused for hours as they moan about how slow it is, how it doesn't seem to be even close to be being finished and how awful an advert for what you can do with WPF that black UI is. There's something about missing out so much of...

I don't miss not having a good XAML editor in visual studio

Over the weekend I was working on some WPF code and getting feelings of being back at basics because I was editing XAML by hand. This was mainly because the designer for VS.NET 2005 is slightly lacking in features but I have this feeling that I'm going to stick with the text editor even when I can drag and drop without any worries of strange things happening. The thing is that unlike Windows Forms, or especially Win32 dialogs, WPF really is straight forwards to write as text. Win32 dialogs were the closest, but they were a pain to do by...

It's all about the Content

I've been showing various people in the office WPF and generally annoying everybody by being overly enthusiastic and so far the reactions have mostly been positive. The enthusiasm seems to be infectious as you can tell when somebody understands what the new functionality means they can now do. The first exciting thing (well, I think it's exciting) that I'm going to enthuse about is the way that controls display text now. In .NET 1, 2 and just about every other Windows UI framework you set the contents of a control by setting a property such as Text or Image. With...