属性内容为null或不是IEnumerable

时间:2016-06-29 12:15:37

标签: xaml xamarin xamarin.forms

我在Xamarin.Forms中有一个测试页面,它给我带来了这个错误,我该如何解决这个问题?

  

属性内容为null或不是IEnumerable

Xaml:

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Project1.Page1">
<ContentPage.Content>
    <Label Text="Page"></Label>
    <Editor Text="I am an Editor" />
  </ContentPage.Content>
</ContentPage>

2 个答案:

答案 0 :(得分:22)

-(void) copytoDocument { NSString *openFile ; NSFileManager *fileManager = [NSFileManager defaultManager]; NSError *error; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *pgnPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.text", @"100_Greatest_games"]]; if ([fileManager fileExistsAtPath:pgnPath] == NO) { NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"100_Greatest_games" ofType:@"text"]; [fileManager copyItemAtPath:resourcePath toPath:pgnPath error:&error]; if (error) { NSLog(@"Error on copying file: %@\nfrom path: %@\ntoPath: %@", error, resourcePath, pgnPath); } } } 属性的类型为Content。你不能有两个观点。替换为

View

答案 1 :(得分:0)

如果有其他人从谷歌到这里而且上面没有修复。对我来说,这是因为我有一个Grid.Row="0"属性集的视图,即使我不小心将它放在实际网格的边界之外。