ItemsView 확장
확장은 ItemsView
다음과 같은 CarouselView
CollectionView
컨트롤 구성 ItemsView
을 지원하는 일련의 확장 메서드를 제공합니다.
확장은 다음 메서드를 제공합니다.
EmptyView
메서드는 EmptyView
요소의 EmptyView
속성을 ItemsView
설정합니다.
다음 예제에서는 텍스트를 사용하여 새 Label
텍스트"The Collection is Empty"
로 설정합니다EmptyView
.
new CollectionView().EmptyView(new Label().Text("The Collection is Empty"));
EmptyViewTemplate
메서드는 EmptyViewTemplate
요소의 EmptyViewTemplate
속성을 ItemsView
설정합니다.
다음 예제에서는 with 텍스트를 포함하는 새 DataTemplate
텍스트"The Collection is Empty"
로 Label
설정합니다EmptyViewTemplate
.
new CollectionView().EmptyViewTemplate(new DataTemplate(() => new Label().Text("The Collection is Empty")));
ItemsSource
메서드는 ItemsSource
요소의 ItemsSource
속성을 ItemsView
설정합니다.
다음 예제에서는 다음을 설정합니다.ItemsSource
new string[] { "C#", "Markup", "Extensions" }
new CollectionView().ItemsSource(new string[] { "C#", "Markup", "Extensions" });
HorizontalScrollBarVisibility
메서드는 HorizontalScrollBarVisibility
요소의 HorizontalScrollBarVisibility
속성을 ItemsView
설정합니다.
다음 예제에서는 다음으로 HorizontalScrollBarVisibility
ScrollBarVisibility.Never
설정합니다.
new CollectionView().HorizontalScrollBarVisibility(ScrollBarVisibility.Never);
VerticalScrollBarVisibility
메서드는 VerticalScrollBarVisibility
요소의 VerticalScrollBarVisibility
속성을 ItemsView
설정합니다.
다음 예제에서는 다음을 설정합니다.VerticalScrollBarVisibility
ScrollBarVisibility.Never
new CollectionView().VerticalScrollBarVisibility(ScrollBarVisibility.Never);
ScrollBarVisibility
메서드는 ScrollBarVisibility
요소의 VerticalScrollBarVisibility
속성과 HorizontalScrollBarVisibility
속성을 ItemsView
모두 설정합니다.
다음 예제에서는 다음과 다음을 VerticalScrollBarVisibility
모두 설정합니다.HorizontalScrollBarVisibility
ScrollBarVisibility.Never
new CollectionView().ScrollBarVisibility(ScrollBarVisibility.Never);
Re기본ingItemsThreshold
메서드는 RemainingItemsThreshold
요소의 RemainingItemsThreshold
속성을 ItemsView
설정합니다.
다음 예제에서는 다음으로 RemainingItemsThreshold
10
설정합니다.
new CollectionView().RemainingItemsThreshold(10);
Re기본ingItemsThresholdReachedCommand
메서드는 RemainingItemsThresholdReachedCommand
요소의 RemainingItemsThresholdReachedCommand
속성을 ItemsView
설정합니다.
다음 예제에서는 새 RemainingItemsThresholdReachedCommand
Command
것으로 설정합니다.
new CollectionView().RemainingItemsThresholdReachedCommand(new Command(async () => await DisplayAlert("Threshold Reached", "", "OK")));
Theere는 속성과 속성을 모두 RemainingItemsThresholdReachedCommand
설정하는 두 번째 오버로드입니다 RemainingItemsThresholdReachedCommandParameter
.
다음 예제에서는 새 RemainingItemsThresholdReachedCommand
Command<string>
개체로 설정하고 다음으로 "No Items Remaining"
설정합니다RemainingItemsThresholdReachedCommandParameter
.
new CollectionView().RemainingItemsThresholdReachedCommand(new Command<string>(async text => await DisplayAlert("Threshold Reached", text, "OK"), "No Items Remaining"));
Re기본ingItemsThresholdReachedCommandParameter
메서드는 RemainingItemsThresholdReachedCommandParameter
요소의 RemainingItemsThresholdReachedCommandParameter
속성을 ItemsView
설정합니다.
다음 예제에서는 다음으로 RemainingItemsThresholdReachedCommandParameter
"Hello World"
설정합니다.
new CollectionView().RemainingItemsThresholdReachedCommandParameter("Hello World");
ItemTemplate
메서드는 ItemTemplate
요소의 ItemTemplate
속성을 ItemsView
설정합니다.
다음 예제에서는 ItemsSource에 바인딩된 새 항목을 포함하는 Label
TextProperty
새 DataTemplate
항목으로 설정합니다ItemTemplate
.
new CollectionView().ItemTemplate(new DataTemplate(() => new Label().Bind(Label.TextProperty, Binding.SelfPath)));
ItemsUpdatingScrollMode
메서드는 ItemsUpdatingScrollMode
요소의 ItemsUpdatingScrollMode
속성을 ItemsView
설정합니다.
다음 예제에서는 다음으로 ItemsUpdatingScrollMode
ItemsUpdatingScrollMode.KeepLastItemInView
설정합니다.
new CollectionView().ItemsUpdatingScrollMode(ItemsUpdatingScrollMode.KeepLastItemInView);
.NET MAUI Community Toolkit
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기