ItemSwipeContentTemplate in C#

5 posts, 0 answers
  1. Muhammad
    Muhammad avatar
    7 posts
    Member since:
    May 2014

    Posted 11 May 2016 Link to this post

    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; } }


     

  2. mo
    mo avatar
    10 posts
    Member since:
    Aug 2017

    Posted 07 Sep in reply to Muhammad Link to this post

    did you found a solution for this :D :D 
  3. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    481 posts

    Posted 08 Sep Link to this post

    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
  4. Matt
    Matt avatar
    3 posts
    Member since:
    Aug 2017

    Posted 11 Sep in reply to Stefan Nenchev Link to this post

    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).
  5. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    389 posts

    Posted 13 Sep Link to this post

    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
Back to Top