Reynevan
Reynevan

Reputation: 1545

Failed to assign to property 'Microsoft.Toolkit.Uwp.UI.Controls.AdaptiveGridView.DesiredWidth'

Every time my UWP app is loading a page with AdaptiveGridView from the Microsoft.UWP.Toolkit I'm getting this exception:

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]

Here is an example XAML definition for the AdaptiveGridView control from the main page of my app:

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

Also, here's my project.json, just in case:

{
  "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": {}
  }
}

Am I missing some references? Did it set up something incorrectly?

Thank you!

Upvotes: 0

Views: 440

Answers (1)

Nico Zhu
Nico Zhu

Reputation: 32785

The text associated with this error code could not be found.

When I use "Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0" in the project, it throw exception as you mentioned. However, when I update the Microsoft.NETCore.UniversalWindowsPlatform version to 5.4.0(Visual Studio 2017), it works well. Please try to update Microsoft.NETCore.UniversalWindowsPlatform to latest stable version.

Install-Package Microsoft.NETCore.UniversalWindowsPlatform -Version 5.4.0

Upvotes: 2

Related Questions