This is a migrated thread and some comments may be shown as answers.

ItemSwipeContentTemplate in C#

4 Answers 121 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Muhammad
Top achievements
Rank 1
Muhammad asked on 11 May 2016, 08:41 AM

HI, 

I am trying to define listview ItemSwipeContentTemplate but via C#. Can someone help me convert the XAML declaration here to C# alternate.

 

http://docs.telerik.com/devtools/xamarin/controls/listview/features/listview-features-cell-swipe

THIS IS WORKING:
<telerikDataControls:RadListView.ItemSwipeContentTemplate><DataTemplate><Grid><Grid.ColumnDefinitions><ColumnDefinition Width="100"/><ColumnDefinition/><ColumnDefinition Width="100"/></Grid.ColumnDefinitions><Button Text="increase" TextColor="White" BackgroundColor="#FF9966" Clicked="IncreaseButtonClicked"/><Button Text="decrease" TextColor="White" BackgroundColor="#66CCFF" Clicked="DecreaseButtonClicked" Grid.Column="2"/></Grid></DataTemplate></telerikDataControls:RadListView.ItemSwipeContentTemplate>

 

THIS IS NOT WORKING: 

Productlist.ItemSwipeContentTemplate = new DataTemplate(typeof(Itemcell));

public class Itemcell : ItemSwipeTemplateCell { public Itemcell() { Label text = new Label (){Text="Edit" }; this.View = text; } }


 

4 Answers, 1 is accepted

Sort by
0
mo
Top achievements
Rank 1
answered on 07 Sep 2017, 08:19 AM
did you found a solution for this :D :D 
0
Stefan Nenchev
Telerik team
answered on 08 Sep 2017, 06:35 AM
Hello,

You can do the following:

listView.ItemSwipeContentTemplate = new DataTemplate(() =>
{
var mainGrid = new Grid { ColumnSpacing = 0, RowSpacing = 0, Padding = 0, Margin = 0 };
mainGrid.Children.Add(new Label { Text = "Sign", TextColor = Color.Red });
return mainGrid;
});


Regards,
Stefan Nenchev
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Matt
Top achievements
Rank 1
answered on 11 Sep 2017, 08:22 PM
I tried this and I'm getting the "Sign" appearing no matter which direction I swipe, but if I swipe to the left the text appears on top of the normal content (with a gap on the right).
0
Lance | Manager Technical Support
Telerik team
answered on 13 Sep 2017, 05:47 PM
Hello Matt,

If you're seeing this on iOS there are additional considerations, please see the note under the Properties section in this documentation.

If you're stilling seeing a problem after configuring SwipeThreshold, please open a support ticket here and attach the relevant code that we can use to reproduce the issue. It would also be helpful to see a screenshot of the problem as it appears in your deployment.

This will allow us to investigate further and work on a direct solution for you.

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ListView
Asked by
Muhammad
Top achievements
Rank 1
Answers by
mo
Top achievements
Rank 1
Stefan Nenchev
Telerik team
Matt
Top achievements
Rank 1
Lance | Manager Technical Support
Telerik team
Share this question
or