[英]Xamarin Forms CollectionView doesn't have KeyboardDismissMode property
I want to hide keyboard on scroll on iOS. If i'm using ListView
, i can create ListViewRenderer
for iOS and set Control.KeyboardDismissMode = UIScrollViewKeyboardDismissMode.Interactive;
我想在 iOS 上的滚动条上隐藏键盘。如果我使用
ListView
,我可以为 iOS 创建ListViewRenderer
并设置Control.KeyboardDismissMode = UIScrollViewKeyboardDismissMode.Interactive;
and its works fine.它工作正常。
But how to achieve the same result with CollectionView
?但是如何使用
CollectionView
实现相同的结果呢? There is no KeyboardDismissMode
property in CollectionViewRenderer
. CollectionViewRenderer
中没有KeyboardDismissMode
属性。
Apparently there is UICollectionView
in Control.Subviews[0]
and UICollectionVIew
has property KeyboardDismissMode
.显然
Control.Subviews[0]
中有UICollectionView
,而UICollectionVIew
有属性KeyboardDismissMode
。
protected override void OnElementChanged(ElementChangedEventArgs<GroupableItemsView> e)
{
base.OnElementChanged(e);
if (Control != null)
{
var uiCollectionView = Control.Subviews[0] as UICollectionView;
uiCollectionView.KeyboardDismissMode = UIScrollViewKeyboardDismissMode.Interactive;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.