마치 높이가 Items
이고 높이가 Items
인 ListView
과 같아야합니다.ListView의 높이를 Xamarin.Form에있는 ListViewItems의 높이와 같게 설정하는 방법은 무엇입니까?
높이를 얻는 방법 ListViewItem
?
myListView.RowHeight
은 -1
입니다.
DataTemplate dTemplate = new DataTemplate(() => {
StackLayout sl = new StackLayout {
VerticalOptions = LayoutOptions.FillAndExpand,
Orientation = StackOrientation.Horizontal,
Padding = new Thickness(20, 10, 0, 10),
Spacing = 20
};
var temp = new Label { FontSize = 20 };
temp.SetBinding(Label.TextProperty, ".");
sl.Children.Add(temp);
return new ViewCell { View = sl };
});
ListView myListView = new ListView {
VerticalOptions = LayoutOptions.FillAndExpand,
ItemsSource = stringList,
ItemTemplate = dTemplate
BackgroundColor = Color.Red
};
나는 구조를 다음을 사용 (내가 XAML을 사용하지 않음) :
나는 ListView
이 방법을 선언
ListView
ISN의 0
ListViewItems
(크기 보이는 방법
<NavigationPage>
<ContentPage>
<ScrollView>
<StackLayout>
<ListView>
...
값의 수에 따라 변함) :
StackLayout으로 충분합니다. 항목의 전체 높이가 화면 높이보다 큰 경우 목록보기가 너무 커집니다. – Bonelol