michaeled / FormsPopup

Xamarin.Forms Popup View
MIT License
75 stars 22 forks source link

Having problems with ListView in Xaml Popup #18

Open stephenvfoster opened 7 years ago

stephenvfoster commented 7 years ago

Michael,

Great popup!

However, I think I may be pushing its limits.

I have a list view (see below) in the popup. It displays just fine, however, selection of an item is very tough. If I touch an item, the item is not highlighted, the ItemSelected property is not set and the ItemSelected event is not fired. I've tried with xaml bound events and when binding the event in code. I can get the item selected, highlighted, the property set and the event fired if I press and hold or drag a bit -- but rarely.

Note:

Your assistance is very much appreciated!

Stephen

<popup:Popup  x:Name="NewPopup"
              XPositionRequest=".5"
              YPositionRequest=".5"
              ContentWidthRequest=".8"
              ContentHeightRequest=".5"

              TopBorderColor="Gray"
              LeftBorderColor="Gray"
              BottomBorderColor="Gray"
              RightBorderColor="Gray"
    >
  <popup:Popup.Header>
    <StackLayout  Orientation="Horizontal"
                  VisualElement.BackgroundColor="White"
                  >
      <Label  Text="{res:Translate NewPopupHeader}"
              HorizontalTextAlignment="Start"
              HorizontalOptions="StartAndExpand"
              VerticalOptions="Center"
              />
      <Button Text="{res:Translate DoneButton}"
              Clicked="OnNewPopupOkClicked"
              HorizontalOptions="End"
              VerticalOptions="Center"
              />
    </StackLayout>
  </popup:Popup.Header>
  <popup:Popup.Body>
    <ListView x:Name="NewList"
              IsGroupingEnabled="True"
              GroupDisplayBinding="{Binding Name}"
              HasUnevenRows="True"
              HorizontalOptions="FillAndExpand"
              VerticalOptions="FillAndExpand"
          >
      <ListView.ItemTemplate>
        <DataTemplate>
          <ViewCell>
            <StackLayout  Orientation="Vertical">
              <Label  Text="{Binding Path=TypeName}"
                      HorizontalOptions="StartAndExpand"
                      FontSize="Small"
                      />
              <Label  Text="{Binding Path=TypeDescription}"
                      HorizontalOptions="StartAndExpand"
                      FontSize="Micro"
                      />
            </StackLayout>
          </ViewCell>
        </DataTemplate>
      </ListView.ItemTemplate>
    </ListView>
  </popup:Popup.Body>
</popup:Popup>
stephenvfoster commented 7 years ago

Michael,

I was able to work around this problem by commenting out the last line in Popup.cs - the call to TapGestureRecognizerVisitor.Visit(..).

Is there a way to only get the tapped event when the user taps outside the popup?

Thanks,

Stephen