I am a complete Blend novice with 2 day’s experience so please forgive me if my terminology makes no sense. I’m using Blend 3 Mix09 Preview, and I’m trying to modify the main window template of a WPF UI so that I can change the main window borders, title bar & control buttons. I go through the process of creating a ControlTemplate resource and modify the properties of the window parts I want to change. I then attempt to build the project and I get the following error:
“The type or namespace name ‘Expression’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?)” in file MainWindow.g.cs
Here are the steps I take:
New project: “Test1”; right-click on the top-level Window object in the Objects & Timeline area.Select > Edit Control Parts (Template) > Edit a Copy
In the Create ControlTemplate Resource dialog I give it the name MyTemplate and select Define in This document (with Window:Window selected).
In Objects & Timeline I now see the scope change to MyTemplate (WindowInstance Template) with the Template object and its constituent parts:
I select the 'topResizeFrame" object which then displays all the options in Properties panel. I change a couple of things such as color and width. I repeat this for the left, right and bottom ResizeFrames, and make some similar changes to the caption object.
Returning to the main window, I see the original window and what looks like an inset of the template I just created with frame colors and size as I specified.
I build the project and get the namespace error mentioned above.
I’ve read this excellent tutorial on custom WPF windows http://www.kirupa.com/blend_wpf/custom_wpf_windows.htm, but was hoping to take the seemingly easier route of modifying an existing window template so as to maintain the system functions such as min/maximize, border resize and window drag (C# coding isn’t my strongest point).
Any suggestions would be very much appreciated.