The name 'foo' is not exist in namespace 'http://foo...'

171 Views Asked by At

I have an WPF solution and this solution consist of 3 project: 1-A project that has several WPF user control inside 2-Another project that has several WPF user control inside 3-A project which has Resources for 2 WPF projects above.

As you know, if you have common settings for you views like that -Using Same FontFamily. -Using same FontSize -Using same FontWeight -Using same BackroundBrush for all your User Controls etc.. You need to declare this setters in you all usercontrol tags like below:

<UserControl ....
    FontFamily="{DynamicResource MyFontFamily}" 
    FontSize="{DynamicResource MyFontSize}" 
    FontWeight="{DynamicResource MyFontWeight}" 
    Background="{DynamicResource MyAppBgBrush2}"
    Width="250" d:DesignHeight="350">
    <Grid/>......

But I dont want to write same setters in all my UserControls. For thi reason, I decided to move this property setting in to a new c# file and locate it in Resource Project.

using System.Windows.Controls;

namespace Resources
{
    public class PageBase : UserControl 
    {
        public PageBase()
        {
            SetResourceReference(FontFamilyProperty, "MyFontFamily");
            SetResourceReference(FontSizeProperty, "MyFontSize");
            SetResourceReference(FontWeightProperty, "MyFontWeight");
            SetResourceReference(BackgroundProperty, "MyAppBgBrush2");
        }
    }
}

So, In my Resource project, I adited AssemlyInfo.cs file like this:

[assembly: System.Windows.Markup.XmlnsDefinition("http://schemas.sat.com/winfx/2010/xaml/internalresources", "Resources")]

This edit gives me ability to declare/create a user control like below:

<internalresources:PageBase
            xmlns:internalresources="http://schemas.sat.com/winfx/2010/xaml/internalresources">
      <Grid>DoWhatEver<Grid/>
<internalresources:PageBase/>

From now, I do not have to create a usercontrol view which its tags start with <UserControl...., I can start with <internalresources:PageBase......

My Question is that, VisualStudio 2010 can show me Design of all my user control bu Expression blend can not. Interesting part is that both in VS and Blend, my project compiling without any error But when I try to open my views in blend it says:

-The namespace 'PageBase' does not exist in namespace "http://schemas.sat.com/winfx/2010/xaml/internalresources"

P.S: References are added properly to my Project and My project was suitable to open with blend.

0

There are 0 best solutions below