作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
下面的代码有一个奇怪的问题:
<Page
x:Class="FuckNumberBox.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FuckNumberBox"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<NumberBox x:Name="BeginNumberBox"
Header="Enter an integer:"
Value="1"
SpinButtonPlacementMode="Compact"
SmallChange="10"
LargeChange="100"/>
</Grid>
</Page>
创建项目后,在我添加 <NumberBox>
之前没有进行任何更改.会出现三个编译错误:
我尝试更新 NuGet 包:
但是错误依旧。
我该如何修复?
我真的需要一些帮助:/
开发环境:
IDE:Visual Studio 2019
UWP项目目标版本:Windows 10,版本1903(10.0; Build18362)
UWP 项目最低版本:Windows 10,版本 1903(10.0;Build 18362)
最佳答案
从这里document NumberBox,可以看到NumberBox在Microsoft.UI.Xaml.Controls命名空间下,适用于WinUI。正如@magicandre1981 所说,您需要安装 Microsoft.UI.Xaml nuget 包并将 Windows UI (WinUI) 主题资源添加到您的 App.xaml 资源。然后在xaml中添加命名空间即可使用。
应用程序.xaml:
<Application ...>
<Application.Resources>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
</Application.Resources>
</Application>
.xaml:
<Page
x:Class="FuckNumberBox.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FuckNumberBox"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
xmlns:controls="using:Microsoft.UI.Xaml.Controls">
<Grid>
<controls:NumberBox x:Name="BeginNumberBox"
Header="Enter an integer:"
Value="1"
SpinButtonPlacementMode="Compact"
SmallChange="10"
LargeChange="100"/>
</Grid>
</Page>
关于c# - 错误 XDG0008 : NumberBox is not supported in a Universal Windows Platform project,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59932074/
我是一名优秀的程序员,十分优秀!