Приложение Xamarin UWP выдает System.MissingFieldException: поле не найдено: 'Xamarin.Forms.VisualElement.StyleProperty' - PullRequest
0 голосов
/ 20 февраля 2019

У меня есть приложение для Android, iOS и UWP.Главная страница xaml использует свойство стиля в метке, например:

<Label Text="{Binding term}"
   LineBreakMode="WordWrap" 
   Style="{DynamicResource ListItemTextStyle}" 
   FontSize="24" />

Это прекрасно работает в iOS и Android, но при попытке запустить в симуляторе UWP или локально, я получаю ошибку, найденную ниже,Если я удаляю все ссылки на стили, все работает снова ... без каких-либо стилей, конечно

Буду признателен за любые предложения о том, как заставить это работать правильно.

Exception thrown: 'System.MissingFieldException' in Xamarin.Forms.Core.dll
System.MissingFieldException: Field not found: 'Xamarin.Forms.VisualElement.StyleProperty'.
   at SomeApp.Views.ItemsPage.<InitializeComponent>_anonXamlCDataTemplate_1.LoadDataTemplate()
   at Xamarin.Forms.ElementTemplate.CreateContent()
   at Xamarin.Forms.Internals.TemplatedItemsList`2.ActivateContent(Int32 index, Object item)
   at Xamarin.Forms.Internals.TemplatedItemsList`2.CreateContent(Int32 index, Object item, Boolean insert)
   at Xamarin.Forms.Internals.TemplatedItemsList`2.ConvertContent(Int32 startingIndex, IList items, Boolean forceCreate, Boolean setIndex)
   at Xamarin.Forms.Internals.TemplatedItemsList`2.OnProxyCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at Xamarin.Forms.ListProxy.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Xamarin.Forms.ListProxy.<>c__DisplayClass33_0.<OnCollectionChanged>b__0()
   at Xamarin.Forms.ListProxy.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at Xamarin.Forms.ListProxy.WeakNotifyProxy.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   at System.Collections.ObjectModel.Collection`1.Add(T item)
   at SomeApp.ViewModels.ItemsViewModel.<ExecuteLoadItemsCommand>d__9.MoveNext()
...