每次我的UWP应用加载AdaptiveGridView
中Microsoft.UWP.Toolkit
的网页时,我都会收到此例外:
The text associated with this error code could not be found.
Failed to assign to property 'Microsoft.Toolkit.Uwp.UI.Controls.AdaptiveGridView.DesiredWidth'. [Line: 30 Position: 183]
以下是我应用主页面中AdaptiveGridView
控件的XAML定义示例:
<toolkit:AdaptiveGridView ItemsSource="{Binding Path=Data}" Padding="5" Grid.Row="1" SelectionMode="None" IsItemClickEnabled="True" ItemClick="AnimeClick" DesiredWidth="400" ItemHeight="74">
<toolkit:AdaptiveGridView.ItemTemplate>
<DataTemplate>
<Grid Height="74" Background="#242424" Margin="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="54" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Image Margin="2" Source="{Binding Path=Thumbnail}" />
<TextBlock Grid.Column="1" TextAlignment="Center" FontWeight="Medium" FontSize="16" TextWrapping="WrapWholeWords" Text="{Binding Path=Name}" />
</Grid>
</DataTemplate>
</toolkit:AdaptiveGridView.ItemTemplate>
</toolkit:AdaptiveGridView>
另外,这里是project.json
,以防万一:
{
"dependencies": {
"Fody": "2.1.2",
"Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0",
"Microsoft.Toolkit.Uwp": "1.5.1",
"Microsoft.Toolkit.Uwp.UI": "1.5.1",
"Microsoft.Toolkit.Uwp.UI.Controls": "1.5.1",
"Newtonsoft.Json": "9.0.1",
"PropertyChanged.Fody": "2.1.4",
"Win2D.UWP": "1.21.0"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}
我错过了一些参考文献吗?它设置错误吗?
谢谢!
答案 0 :(得分:2)
找不到与此错误代码关联的文字。
当我在项目中使用“Microsoft.NETCore.UniversalWindowsPlatform”:“5.1.0”时,它会像你提到的那样抛出异常。但是,当我更新
Microsoft.NETCore.UniversalWindowsPlatform
版本为5.4.0(Visual Studio 2017),效果很好。
请尝试将Microsoft.NETCore.UniversalWindowsPlatform
更新为最新的稳定版本。
Install-Package Microsoft.NETCore.UniversalWindowsPlatform -Version 5.4.0