Set Cell BackgroundColor on Cell Swipe Button Tap

2 posts, 0 answers
  1. Trevor
    Trevor avatar
    22 posts
    Member since:
    Feb 2017

    Posted 02 Nov 2017 Link to this post

    So I have a button that is revealed when a user swipes a cell. I then want to change the Cell BackgroundColor when the revealed button is tapped. I am having a tough time since the Button has no correlation to the cell the user swiped. I tried to implement a style trigger as I feel this would be the way to do it but I am not sure how to implement that with the RadListView. This is what I tried:


                <Style TargetType="dataControls:RadListView" x:Key="CellStyle">
                        <DataTrigger Binding="{Binding ButtonText}"
                            <Setter Property="BackgroundColor"
                                    Value="White" />
                        <DataTrigger Binding="{Binding ButtonText}"
                            <Setter Property="BackgroundColor"
                                    Value="Gray" />
  2. Stefan Nenchev
    Stefan Nenchev avatar
    665 posts

    Posted 07 Nov 2017 Link to this post

    Hello, Trevor,

    You can use a custom ListView ItemTemplateSelector and return different templates based on a property of the business object. You can then change this property from the button inside the ItemSwipeContentTemplate and when you switch back to the standard view - the change will be applied. Please have a look at the attached sample where clicking the button changes the foreground color of the item.

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