Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

How can I tell which item assoicated with a TimePicker in a ListView has been modified?

$
0
0

I have a ListView that includes a TimePicker:

<ListView.ItemTemplate>
                  <DataTemplate>
                     <ViewCell>
                        <StackLayout Orientation="Horizontal">
                           <TimePicker Time="{Binding MyTimeSpan}" PropertyChanged="OnTimePickerPropertyChanged" >
                              <TimePicker.Format>hh:mm tt</TimePicker.Format>
                           </TimePicker>
                           <Label Text="{Binding Text}">
                              <Label.GestureRecognizers>
                                 <TapGestureRecognizer Tapped="ItemTextTapped" CommandParameter="{Binding Id}"></TapGestureRecognizer>
                              </Label.GestureRecognizers>
                           </Label>
                        </StackLayout>
                     </ViewCell>
                  </DataTemplate>
               </ListView.ItemTemplate>
            </ListView>

Then the event handler:

      void OnTimePickerPropertyChanged(object sender, PropertyChangedEventArgs args)
      {
         if (!args.PropertyName.Equals("Time"))
            return;
         TimePicker picker = (TimePicker)sender;
         // which Item is it?
      }

How can I tell which Item is associated with the TimePicker?

FYI, Firefox does not work with your website.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>