Avalonia 无法解析命名空间
所以我正在使用 Avalonia,并且需要为特定类型编写 DataTemplate。但是当我将 DataType 设置为所需的类型并运行它时,它会抛出此错误。
D:\Some\Random\Path\Tachyon\src/App.axaml(9,23,9,23): Avalonia error XAMLIL:
Unable to resolve type FileTabItem from namespace https://github.com/avaloniaui Line 9, position 23. [D:\Some\Random\Path\Tachyon\Tachyon.csproj]
The build failed. Fix the build errors and run again.
这是我需要访问命名空间的地方:
<TabControl>
<TabControl.ContentTemplate>
<DataTemplate DataType="srv:FileTabItem">
<TextBlock Text="{Binding Content}"/>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
以及我如何声明 srv
变量(或者无论你如何称呼它 idk,我不是术语专家)
<Window xmlns:srv="clr-namespace:Tachyon.Services">
完整的 xaml 文件: https://paste.myst.rs/1eoeh40t
是的,它们是一个名称空间,其中 FileTabItem 作为类在其中。
So I was using Avalonia, and needed to write a DataTemplate for a specific type. But when I set the DataType to the required type and run it, it throws this error.
D:\Some\Random\Path\Tachyon\src/App.axaml(9,23,9,23): Avalonia error XAMLIL:
Unable to resolve type FileTabItem from namespace https://github.com/avaloniaui Line 9, position 23. [D:\Some\Random\Path\Tachyon\Tachyon.csproj]
The build failed. Fix the build errors and run again.
This is where I need to access the namespace:
<TabControl>
<TabControl.ContentTemplate>
<DataTemplate DataType="srv:FileTabItem">
<TextBlock Text="{Binding Content}"/>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
and how I've declared the srv
variable(or whatever u call it idk I'm no expert in terminology)
<Window xmlns:srv="clr-namespace:Tachyon.Services">
Complete xaml file: https://paste.myst.rs/1eoeh40t
And yes, their is a namespace with FileTabItem as a class in it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Avalonia 还支持 Xamarin Forms 风格的命名空间“using:”语法,它会更努力地为您找到命名空间...
到目前为止,我找到的唯一文档位于功能拉取请求中:
功能:替代“using:”语法将命名空间包含到 XAML 文件
Avalonia also supports a Xamarin Forms style "using:" syntax for namespaces that tries harder to find namespaces for you...
The only documentation I've found so far is in the features pull request:
Feature: alternative "using:" syntax to include namespace to XAML file