首页 > 解决方案 > 无法两次点击相同的列表视图项目xamarin

问题描述

在使用 SelectedItem 属性的 xamarin 列表视图中,我无法访问相同的列表视图项两次。1.点击列表中的一个项目。它导航到其他后面。2.返回上一页并点击它正在导航到其他页面的列表中的相同项目。

  <ListView
            ItemsSource="{Binding UIUnionListWrapper}"
            **SelectedItem="{Binding DeviceSession, Mode=TwoWay}">**
  internal DeviceSession _deviceSession;

    public DeviceSession DeviceSession
    {
        get { return _deviceSession; }
        set
        {
            SetProperty(ref _deviceSession, value);
            HandleItemSelectedAsync(); //navigating to other page
        }
    }

标签: xamarin

解决方案


此代码按预期工作:if (SelectedItem != null){await PushModelPage(newSessionListPage(SelectedItem, Navigation));SelectedItem = null;}


推荐阅读