Having problems with ListView in Xaml Popup
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:
- I'm setting ListView's ItemSource in code - the items show and scroll as expected.
- This is without a Tapped event handler - I've removed it because it seemed to interfere.
- Testing with Visual Studio emulator, iOS V9, iPhone 6; Xamarin forms v2.3.3.175 (latest)
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>
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