c# - XAML 找不到命名空间。有时

标签 c# wpf xaml namespaces

可能是 Visual Studio 错误,但它绝对令人气愤,我找不到解决方案,甚至找不到它发生的原因。

在我的应用程序中,我在可停靠面板的命名空间静态内容中有一个 XAML 文件列表。

程序运行良好,除了一些任意警告之外,程序中的任何地方都没有错误。

一些 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>

标签 sc: 是命名空间 StaticContent。命名空间包括这些文件。今天早上打开项目时,它找不到引用 XAML 页面的命名空间。在多次按下重新构建并收到一些“重建失败”后,它就决定工作了吗?

有任何想法吗?

最佳答案

'StaticContent' 是否在另一个程序集下定义?

如果是这样,请查看项目的属性并检查“默认命名空间”
如果它是你所期望的。

关于c# - XAML 找不到命名空间。有时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42790908/

相关文章:

c# - 为什么事件指示器不显示?

wpf - 在生成的 Entity Framework 类上实现 INotifyPropertyChanged

c# - 获取通过 DataTable.Select() 获取的行旁边的行

c# - 如何处理具有相同父级的不同事件处理程序?

c# - Asp.net MVC 导出表格到 Excel |外键显示

c# - 无法在我的 WPF 应用程序中读取 True Type 字体文件!

c# - 在 ListView 中搜索字符串和过滤器

c# - 从 Datatable C# Windows 窗体应用程序中选择前 N 行

c# - WPF:无法识别或无法从 XAML 访问整数 CLR 属性

c# - 适用于 .NET MAUI WebView 的 InMemory HTML 和图像