2017-02-14 1 views
2

안녕하세요 동료 자 마린 피해자, 나는 itemsource에서 모든 항목이 표시됩니다 내 ListView에,에 문제가 있어요자 마린은 모든 항목

을 표시하는 것은 아닙니다 목록보기 Froms. 총 6 개 중 6 개가 표시됩니다. 다음은 내가 목록보기 (목록보기가 middlepart에 사용)를 사용하는 방법 당신이 볼 수있는 내 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="Prototype_Deinceps.views.subject.DetailPage" 
     xmlns:multiplechoices="clr-namespace:Prototype_Deinceps.viewincludes.QuestionTypes;assembly=Prototype_Deinceps" 
     xmlns:CustomElements="clr-namespace:Prototype_Deinceps.CustomElements;assembly=Prototype_Deinceps" 
     Title="Detail"> 
<!-- ToolBar --> 
<ContentPage.ToolbarItems> 
<ToolbarItem Icon="Edit.png"> 
    <ToolbarItem.Text> 
    <OnPlatform x:TypeArguments="x:String" 
       iOS="Wijzig"/> 
    </ToolbarItem.Text> 
</ToolbarItem> 
</ContentPage.ToolbarItems> 

<Grid> 
    <Grid.RowDefinitions> 
    <RowDefinition Height="6*" /> 
    <RowDefinition Height= "9*" /> 
    <RowDefinition Height="6*" /> 
    </Grid.RowDefinitions> 
    <Grid.ColumnDefinitions> 
    <ColumnDefinition Width="*" /> 
    <ColumnDefinition Width="*" /> 
    </Grid.ColumnDefinitions> 

    <!-- Top part of the screen that consist of basic info of the entity--> 
    <StackLayout x:Name="BasicInfo" Margin="10,10,10,5" Grid.Row="0" Grid.Column="0"> 
    <Label Text="Basic Info" FontSize="Large"/> 
    <BoxView Color="Black" WidthRequest ="100" HeightRequest="1"/> 
    <Label x:Name="text1" /> 
    <Label x:Name="text2" /> 
    <Label x:Name="text3" /> 
    <Label x:Name="text4" /> 
    </StackLayout> 
    <Image x:Name="EntityImage" Margin="10" Grid.Row="0" Grid.Column="1"/> 
    <!-- End of Top --> 

    <!-- Middle part of the screen where the questions are displayed about the entity--> 
    <StackLayout x:Name="Questions" Margin="5,10,10,0" Grid.Row="1" Grid.ColumnSpan="2"> 
    <Label Text="Questions" FontSize="Large"/> 
    <BoxView Color="Black" WidthRequest ="100" HeightRequest="1"/> 
    <ScrollView> 
     <ListView x:Name="QuestionListView" 
       HasUnevenRows="True" 
       ItemTapped="OnItemTapped"> 
     <ListView.ItemTemplate> 
      <DataTemplate> 
      <ViewCell> 
       <StackLayout x:Name="ListItem" Orientation="Horizontal" > 
       <multiplechoices:MultipleChoice x:Name="multi" IsVisible="{Binding isMultipleChoice} "/> 
       <multiplechoices:TrueFalse IsVisible="{Binding isTrueFalse}"/> 
       <multiplechoices:Text IsVisible="{Binding isText}"/> 
       <multiplechoices:LineText IsVisible="{Binding isLineText}"/>     
      </StackLayout> 
      </ViewCell> 
      </DataTemplate> 
     </ListView.ItemTemplate> 
     </ListView> 
    </ScrollView> 
    </StackLayout> 
    <!-- End of Middle --> 

    <!-- Bottem part of the screen where you can put a note of the entity and save your info--> 
    <StackLayout x:Name="Extra" Margin="0,10,30,5" Grid.Row="2" Grid.ColumnSpan="2"> 
    <Label Text="Opmerkingen" FontSize="Large"/> 
    <BoxView Color="Black" WidthRequest ="100" HeightRequest="1"/> 
    <CustomElements:CustomEditor PlaceHolder="Schrijf hier een opmerking..."/> 
    <Button Text="Opslaan" HorizontalOptions="EndAndExpand" BackgroundColor="#AB001C" TextColor="White"/> 
    </StackLayout> 
    <!-- End of Bottom --> 

</Grid> 
</ContentPage> 

당신은 내가 내 항목이 무엇인지 정의 테 부분이있다. 필자는 12 개의 모든 항목이 itemsource에 추가 된 것을 볼 수 있습니다. 문제가 여기에있는 것은 의심 스럽지만 여기에 코드가 있습니다.

public partial class DetailPage : ContentPage 
{ 

    public Subject sb; 
    int i; 
    public DetailPage(Subject subject) 
    { 
     InitializeComponent(); 

     sb = subject; 
     TapGestureRecognizer tap = new TapGestureRecognizer(); 
     EntityImage.Source = ImageSource.FromFile("nobody_moriginal.jpg"); 
     text1.Text = subject.text1; 
     text2.Text = subject.text2; 
     text3.Text = subject.text3; 
     text4.Text = subject.text4; 

     tap.Tapped += OnTap; 
     BasicInfo.GestureRecognizers.Add(tap); 

     QuestionListView.ItemsSource = new List<Question> 
     { 
      new Question 
      { 
       Vraag = "1+1=?", 
       TypeQuestion = Question.QuestionTypes.MulptipleChoice 
      }, 
      new Question 
      { 
       Vraag= "Is dit waar?", 
       TypeQuestion = Question.QuestionTypes.TrueFalse 
      }, 
      new Question 
      { 
       Vraag= "Hoe ziet jou leven eruit?", 
       TypeQuestion = Question.QuestionTypes.Text 
      }, 
      new Question 
      { 
       Vraag= "Wat vind u van Tim?(Max 150 karakters)", 
       TypeQuestion = Question.QuestionTypes.LineText 
      }, 
      new Question 
      { 
       Vraag= "Wat vind u van Tim?(Max 150 karakters)", 
       TypeQuestion = Question.QuestionTypes.LineText 
      }, 
      new Question 
      { 
       Vraag= "Wat vind u van Tim?(Max 150 karakters)", 
       TypeQuestion = Question.QuestionTypes.LineText 
      }, 
      new Question 
      { 
       Vraag= "Wat vind u van Tim?(Max 150 karakters)", 
       TypeQuestion = Question.QuestionTypes.LineText 
      }, 
      new Question 
      { 
       Vraag= "Wat vind u van Tim?(Max 150 karakters)", 
       TypeQuestion = Question.QuestionTypes.LineText 
      }, 
      new Question 
      { 
       Vraag= "Wat vind u van Tim?(Max 150 karakters)", 
       TypeQuestion = Question.QuestionTypes.LineText 
      }, 
      new Question 
      { 
       Vraag= "Wat vind u van Tim?(Max 150 karakters)", 
       TypeQuestion = Question.QuestionTypes.LineText 
      },    new Question 
      { 
       Vraag= "Hoe ziet jou leven eruit?", 
       TypeQuestion = Question.QuestionTypes.Text 
      },    new Question 
      { 
       Vraag= "Hoe ziet jou leven eruit?", 
       TypeQuestion = Question.QuestionTypes.Text 
      } 
     }; 
    } 

    private async void OnTap(object sender, EventArgs e) 
    { 
     await Navigation.PushAsync(new BasicInfoPage(sb)); 
    } 

    private void OnItemTapped(object sender, ItemTappedEventArgs e) 
    { 
     if (e == null) return; // has been set to null, do not 'process' tapped event 
     ((ListView)sender).SelectedItem = null; // de-select the row 
    } 

미리 감사드립니다.

+0

기본적으로 각 목록보기에는 내부 scrollview가 있습니다. –

+0

기본적으로 listview는 기본적으로 스크롤 할 수 있습니다. Listview를 모두의 부모로 사용하고 그리드를 내부에 바인딩하는 또 다른 방법을 시도해 보겠습니다. 추측하여 그리드는 표시 할 레코드 수를 제한합니다. –

+1

@MikeDarwish 당신 말이 맞아요, 저 또한 상기시켜 주셔서 감사합니다. – Diceble

답변

2

기본적으로 ListViewScrollView 내부가 있으므로 귀하의 경우에는 ScrollView을 사용할 필요가 없습니다.

0

ScrollView에서 ListView를 사용합니다. 그래서 아마 모든 항목이 ListView에 있지만 스크롤 할 수는 없습니다.

+0

나는 내 listview를 스크롤 할 수 있습니다. 그것은 단지 6 번째 아이템 인 – Diceble

+1

에서 잘릴 수도 있습니다. 아마도 내가 틀렸어. 그러나 스크롤없이보십시오. – Vita

+0

아니요, 맞습니다. 나는 scrollview없이 그것을 시도하고 작동합니다. 도움을 주셔서 감사합니다! :) – Diceble

관련 문제