GridView.ScrollIntoView方法

ScrollIntoView方法有两个重载形式:

        //
        // Summary:
        //     Scrolls the list to bring the specified data item into view.
        //
        // Parameters:
        //   item:
        //     The data item to bring into view.
        [Overload("ScrollIntoView")]
      1)  public void ScrollIntoView(object item);
        //
        // Summary:
        //     Scrolls the list to bring the specified data item into view with the specified
        //     alignment.
        //
        // Parameters:
        //   item:
        //     The data item to bring into view.
        //
        //   alignment:
        //     An enumeration value that specifies whether the item uses Default or Leading
        //     alignment.
        [Overload("ScrollIntoViewWithAlignment")]
       2) public void ScrollIntoView(object item, ScrollIntoViewAlignment alignment);

 

第一种方法,只是让第一个选中的item显示在当前视图中。第二个方法中的第二个参数是设置选中的item如何在视图中显示。

ScrollIntoViewAlignment.Leading : 是让第一个选中的item显示在视图的最前端或最上端。

ScrollIntoViewAlignment.Default : 是默认值。只是让第一个选中的item显示在当前视图中,有可能是显示在view的最末端。

 

当设置ScrollIntoViewAlignment.Leading时,ScrollIntoView的第一个参数必须不能为空,否则程序会崩溃。

 

转载于:https://www.cnblogs.com/my-sky/p/GridView-ScrollIntoView.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值