object sender and ItemSwipeCompletedEventArgs e are NULL or just returning an Object instead of data

2 posts, 0 answers
  1. Dan
    Dan avatar
    18 posts
    Member since:
    Apr 2013

    Posted 08 Dec 2017 Link to this post

    I'm having an issue with my RadListView ItemSwipeCompleted method.  I've followed the instructions in the documentation but the example data retrieval code does not work in my project.

    Here's my code:

                    <telerikDataControls:RadListView x:Name="categoriesListview" ItemsSource="{Binding Source}" HeightRequest="200" WidthRequest="500"
                                                     ItemTapped="CategoryRadListView_OnItemTapped"
                                                     IsItemSwipeEnabled="True"
                                                     ItemSwipeCompleted="OnItemSwipeCompleted"
                                                     SwipeOffset="10"
                                                     SwipeThreshold="20"
                                                     BackgroundColor="GhostWhite"
                                                     >
                        <telerikDataControls:RadListView.ItemTemplate>
                            <DataTemplate>
                                <listView:ListViewTemplateCell>
                                    <listView:ListViewTemplateCell.View>
                                        <Grid>
                                            <Label Margin="10" Text="{Binding Category}" Font="{DynamicResource text_size}" />
                                        </Grid>                                    
                                    </listView:ListViewTemplateCell.View>
                                </listView:ListViewTemplateCell>
                            </DataTemplate>
                        </telerikDataControls:RadListView.ItemTemplate>
                        <telerikDataControls:RadListView.ItemSwipeContentTemplate>
                            <DataTemplate>
                                <Grid Margin="0"
                                  Padding="0"
                                  ColumnSpacing="0"
                                  RowSpacing="0">
                                <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="100" />
                                </Grid.ColumnDefinitions>
                                
                                <Label
                                   BackgroundColor="Red"
                                   HorizontalTextAlignment="Center"
                                   Text="delete"
                                   TextColor="White"
                                   VerticalTextAlignment="Center"
                                   WidthRequest="100" />
                                </Grid>
                            </DataTemplate>
                        </telerikDataControls:RadListView.ItemSwipeContentTemplate>
                    </telerikDataControls:RadListView>

     

    The RadListView is working fine, it's ONLY the itemswipe that I can't see any data...

     

    Here's my code behind for the ItemSwipeCompleted event:

            public void OnItemSwipeCompleted(object sender, ItemSwipeCompletedEventArgs e)
            {
                try
                {
                    var row = sender as RadListView;
                    var item = (sender as BindableObject).BindingContext as groceryList;
                    row.EndItemSwipe();

                    statusLabel.Text = "item: " + item + " sender: " + row;
                }
                catch (Exception ex)
                {
                    statusLabel.Text = "Sender: " + sender + " Error: " + ex.ToString();
                }            
            }

     

    sender is just the RadListView control object and item is NULL.

     

  2. Dan
    Dan avatar
    18 posts
    Member since:
    Apr 2013

    Posted 08 Dec 2017 Link to this post

    Never mind, I figured it out.

    e actually contains data in a RadListView itemswipe event.

     

Back to Top