This is a migrated thread and some comments may be shown as answers.
object sender and ItemSwipeCompletedEventArgs e are NULL or just returning an Object instead of data
1 Answer 11 Views
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 08 Dec 2017, 02:02 PM

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.

 

1 Answer, 1 is accepted

Sort by
0
Dan
Top achievements
Rank 1
answered on 08 Dec 2017, 02:21 PM

Never mind, I figured it out.

e actually contains data in a RadListView itemswipe event.

 

Asked by
Dan
Top achievements
Rank 1
Answers by
Dan
Top achievements
Rank 1
Share this question
or