简体   繁体   中英

XAML Can't find namespace. sometimes

Might be a Visual Studio error but it its absolutely infuriating and I can't find the solution or even why its happening.

In my application I have a list of XAML files in the namespace Static Content for dockable panels.

The program runs fine there are no errors anywhere in the program other than a few arbitrary warnings.

some XAML

<Window x:Class="Shell" 
    xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sc="clr-namespace:StaticContent"
    xmlns:ve="clr-namespace:View_Edit"
    Title="View" Width="1024" Height="800" Icon="/component/Images/View.png" 
    Loaded="OnLoaded" IsVisibleChanged="isVisibleChanged" Closing="OnClosing" Background="#E9ECFB"
    WindowStyle="None">

<Grid x:Name="DockingRegion" Margin="0,50,0,0">
        <ad:DockingManager x:Name="DockManager">
            <ad:ResizingPanel>
                <ad:DocumentPane Margin="0,0,10,0">
                    <sc:StartPage Title="Home Page" VerticalContentAlignment="Stretch" 
                        onProjectOpenFail="StartPage_onProjectOpenFail" 
                        onProjectOpenSuccess="StartPage_onProjectOpenSuccess"
                        onProjectCreateSuccess="StartPage_onProjectCreateSuccess"
                        onProjectCreateFail="StartPage_onProjectCreateFail"/>
                </ad:DocumentPane>
                <ad:DockablePane ad:ResizingPanel.ResizeWidth="300" x:Name="ExplorerPane" FontSize="14" FontWeight="Bold">
                    <sc:AboutTab x:Name="about" Title="About" FontSize="14" FontWeight="Bold"/>
                    <sc:ProcessExplorer x:Name="pxProcessExplorer" Title="Process Explorer" FontSize="14"/>
                    <sc:DataExplorer x:Name="adDataExplorer" Title="Data Explorer" FontSize="14"/>
                    <!--<sc:UREPExplorer x:Name="adUREPExplorer" Title="UREP Custom Navigation" FontSize="14" Visibility="Hidden"/>-->
                </ad:DockablePane>
            </ad:ResizingPanel>
        </ad:DockingManager>
    </Grid>

The tag sc: is the namespace StaticContent. The namespace includes these files. When opening the project this morning it couldn't find the namespace to reference the XAML pages. After pressing re-build all a number of times and receiving a few "rebuild failed", it just decided to work?

Any Ideas?

Is 'StaticContent' defined under another assembly?

If so look in the project's Properties and check under 'Default Namepace' if its what you expected it to be.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM