首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Treeview的WPF设计器抱怨在本地命名空间中找不到类型

Treeview的WPF设计器抱怨在本地命名空间中找不到类型
EN

Stack Overflow用户
提问于 2017-09-02 08:01:36
回答 1查看 157关注 0票数 0
代码语言:javascript
复制
<Fluent:RibbonWindow x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:Fluent="urn:fluent-ribbon"
        xmlns:Data="clr-namespace:DispatchData;assembly=DispatchData"
        xmlns:self="clr-namespace:DispatchWPF2"
        mc:Ignorable="d"
        Title="Dispatch Desktop" Height="600" Width="1000" Icon="Images/app1.png">

<Grid Grid.Row="1" ShowGridLines="False">
            <Grid.RowDefinitions>
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" MinWidth="175"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition />
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>


            <TreeView Grid.Column="0" x:Name="DataTree" MinWidth="175" BorderThickness="0">
                <TreeView.Resources>
                    <HierarchicalDataTemplate DataType="{x:Type self:DispatchTreeTerritoryItem}" ItemsSource="{Binding ClientLocations}">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Name}" />
                        </StackPanel>
                    </HierarchicalDataTemplate>
                    <DataTemplate DataType="{x:Type self:DispatchTreeClientLocationItem}">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding ClientName,StringFormat='({0}) '}" />
                            <TextBlock Text="{Binding Address}" />
                        </StackPanel>
                    </DataTemplate>
                </TreeView.Resources>
            </TreeView>
    </Grid>
</Fluent:RibbonWindow>

我在错误列表窗口中得到以下错误..。

名称"DispatchTreeTerritoryItem“不存在于名称空间”clr-命名空间:DispatchWPF2 2“中。

这个错误带我到XAML,TreeView,HierarchicalDataTemplate -在DataType="{x:Type下有蓝色的小块。我知道DispatchTreeTerritoryItem类存在于DispatchWPF2命名空间中。

这将显示为错误窗口中的错误,但它不会阻止编译或运行应用程序。在运行时,一切看起来都和预期的一样。我看到treeview和我所期望的一样,装载了我所期望的数据。

不幸的是,此错误阻止了XAML设计器在Visual 2017中的显示。“设计图面”更改为带有“无效标记”字样的灰色框。我有点以视觉为导向,所以这对我来说很烦人。

对如何使这个错误消失并将我的设计图返回给我有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2017-09-03 00:06:39

重新启动似乎解决了这个问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46011739

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档