2015-06-19 3 views
0

Я пишу Windows Phone 8.1 (WINRT). У меня есть GridView, чтобы показывать фотографии с сервера.Связанные ссылки GridView Параметр неправильный

XAML является:

<Grid x:Name="PhotosGrid" > 
    <GridView 
    x:Name="PhotosGridView" 
    ItemsSource="{Binding}" 
    ContinuumNavigationTransitionInfo.ExitElementContainer="True" 
    IsItemClickEnabled="True" 
    ItemTemplate="{StaticResource PhotosItemTemplate}">  
      <GridView.ItemsPanel> 
       <ItemsPanelTemplate> 
        <ItemsWrapGrid Orientation="Horizontal" /> 
       </ItemsPanelTemplate> 
      </GridView.ItemsPanel> 
    </GridView> 
</Grid> 


<Page.Resources> 
    <DataTemplate x:Name="PhotosItemTemplate"> 
     <ItemsPanelTemplate> 
      <Grid> 
        <Image Source="{Binding Path=photo}"      
          ImageFailed="Photo_ImageFailed" 
        > 
        </Image> 
      </Grid> 
     </ItemsPanelTemplate> 
    </DataTemplate> 
</Page.Resources> 

Класс:

public class Photo 
    { 
     public string photo { get; set; } 
    } 

C#

ObservableCollection<Photo> PhotosList = new ObservableCollection<Photo>(); 
int i = 0; 
foreach(var photos in MyProfileResultObject.Photos) 
    { 
    PhotosList.Add(new Photo { photo = MyProfileResultObject.Photos[i].photo}); 
    i++; 
    }          
PhotosGridView.ItemsSource = PhotosList; 

Но я получаю сообщение об ошибке:

{System.ArgumentException: The parameter is incorrect.

The parameter is incorrect. }

 UnhandledException += (sender, e) => 
     { 
      if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break(); 
     }; 

ответ

1
<GridView.ItemTemplate> 
    <DataTemplate> 
     <Image Source="{Binding Path=photo}" 
     ImageFailed="Photo_ImageFailed" > 
     </Image> 
    </DataTemplate> 
</GridView.ItemTemplate> 
Смежные вопросы