# Help modifying WPF main window template - namespace error

**URL:** <https://forum.kirupa.com/t/help-modifying-wpf-main-window-template-namespace-error/289262>\
**Category:** programming\
**Created:** [May 28, 2009, 6:13am UTC](https://forum.kirupa.com/t/help-modifying-wpf-main-window-template-namespace-error/289262 "2009-05-28T06:13:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew24](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@Andrew24](https://forum.kirupa.com/u/Andrew24)\
**Post date:** [May 28, 2009, 6:13am UTC](https://forum.kirupa.com/t/help-modifying-wpf-main-window-template-namespace-error/289262/1 "2009-05-28T06:13:26Z")

</div>

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:

[LIST=1]  
[_]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).  
 ![](http://forum.kirupa.com/uploads/kirupa/5411/13bb0e76cbbb95cc.jpg)  
[_]In Objects & Timeline I now see the scope change to MyTemplate (WindowInstance Template) with the Template object and its constituent parts:  
  ![](http://forum.kirupa.com/uploads/kirupa/5412/a8dc84260024a922.jpg)  
[_]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.  
  ![](http://forum.kirupa.com/uploads/kirupa/5413/f45ad689f97b26af.png)  
[_]I build the project and get the namespace error mentioned above.  
[/LIST]

I’ve read this excellent tutorial on custom WPF windows [http://www.kirupa.com/blend\_wpf/custom\_wpf\_windows.htm](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.

Thanks,  
Andrew
