简体   繁体   English

Xamarin Forms CollectionView 没有 KeyboardDismissMode 属性

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM