2

My application runs and works absolutely fine. Now I want to use the VS2012 designer to design my MainWindow which is derived type of the HandledWindow from a different library.

Here is my XAML code for MainWindow:

<UI:HandledWindow x:Class="Diamond.Executor.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:UI="clr-namespace:Diamond.Core.UI;assembly=Diamond.Core" Title="MainWindow" Height="250" Width="500" Style="{DynamicResource WindowStandard}" WindowStartupLocation="CenterScreen" Loaded="Initialise"> 

Here is where base type HandledWindow:

namespace Diamond.Core.UI { public class HandledWindow : Window { 

What is wrong here? When I run my application anything works, the bindings, The style and it's template. But suddenly the designer says "'UI' doesn't map to a namespace". I just don't get it. It stops my development really without a reason. Perhaps a VS2012 bug, But I want to insure I am doing everything right and if there is a way to pass that bug and continue using the designer?

4
  • close you visual studio . and then open again and rebuid Commented Dec 2, 2013 at 16:20
  • Is your code running from a network drive? Commented Dec 2, 2013 at 16:37
  • @ethicallogics, I restarted and rebuilt still the same happens, And Blend shows the same exception. ehh... Commented Dec 2, 2013 at 16:44
  • @Sheridan, And I am not working with network drives. Commented Dec 2, 2013 at 16:45

2 Answers 2

5

I've discovered what just causes the issue, But I don't know why, Because by syntax it's okay and logically it works. But XAML's desginer fails to work properly with such data binding expression:

FontSize="{Binding Path=(UI:HandledWindow.FontSizeTitle), Mode=OneWay}" 

(It's part of a style inside the UI namespace that XAML declined in a whole because of this expression) Then I've changed it to this expression:

FontSize="{Binding FontSizeTitle, RelativeSource={RelativeSource TemplatedParent}}" 

It does exactly the same, But now the XAML designer works again and stops ignoring the whole namespace UI because of a single data binding expression.

Anyway, The issue is finally resolved.

Sign up to request clarification or add additional context in comments.

2 Comments

Tip: We can't see this code, you probably are missing some spaces or something in your question.
Good explanation of the solution found here: stackoverflow.com/a/43513543/1770778
0

Just wanted to add that I experienced this same problem but in a different way: I got this exception at runtime. But only after I had added a CLR namespace to my project that referenced a namespace that was in a different project (different) assembly. After doing that, the actual error itself occurred on a binding to something in the namespace from the project itself though (the assembly that the XAML file belonged to), not the namespace from the referenced assembly. Really, really weird. This was on VS2012.

The solution to add Path= to the binding works perfectly in this case too.

I don't know if the XAML designer would also have suffered from this problem in my case because the XAML designer doesn't load anymore for this project because of an unrelated error it throws: The parameter 'frameworkName' cannot be an empty string.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.