This is a migrated thread and some comments may be shown as answers.
Set Cell BackgroundColor on Cell Swipe Button Tap
1 Answer 11 Views
This is a migrated thread and some comments may be shown as answers.
Trevor
Top achievements
Rank 1
Trevor asked on 02 Nov 2017, 06:08 PM

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:

 

<ContentView.Resources>
        <ResourceDictionary>
            <Style TargetType="dataControls:RadListView" x:Key="CellStyle">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding ButtonText}"
                                 Value="Start">
                        <Setter Property="BackgroundColor"
                                Value="White" />
                    </DataTrigger>
                    <DataTrigger Binding="{Binding ButtonText}"
                                 Value="Complete">
                        <Setter Property="BackgroundColor"
                                Value="Gray" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </ResourceDictionary>
    </ContentView.Resources>

1 Answer, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 07 Nov 2017, 11:49 AM
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.

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
Asked by
Trevor
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Share this question
or