Unplanned
Last Updated: 19 Dec 2019 13:23 by ADMIN
Aaron
Created on: 18 Dec 2019 22:02
Category: UI for Xamarin
Type: Bug Report
2
ReorderItemStyle is not applied to RadListView items when SelectionMode is None

When using the __ItemStyle properties of RadListView, they are not being applied if the SelectionMode is set to None. It makes sense that the PressedItemStyle and SelectedItemStyle properties are not used, since they are not applicable if nothing can be selected. However, the ReorderItemStyle in particular should still be used.

 

Example:

    public class ItemStyleNotAppliedExample : ContentPage
    {
        private readonly ListViewItemStyle WhiteBG = new ListViewItemStyle
        {
            BackgroundColor = Color.White
        };

        private readonly ListViewItemStyle YellowBG = new ListViewItemStyle
        {
            BackgroundColor = Color.Yellow
        };

        private readonly ListViewItemStyle RedBG = new ListViewItemStyle
        {
            BackgroundColor = Color.Red
        };

        private readonly ListViewItemStyle BlueBG = new ListViewItemStyle
        {
            BackgroundColor = Color.Blue
        };

        public ItemStyleNotAppliedExample()
        {
            BackgroundColor = Color.Gray;

            var items = new ObservableCollection<Item>
            {
                new Item("Item 1"),
                new Item("Item 2"),
                new Item("Item 3"),
                new Item("Item 4"),
                new Item("Item 5"),
            };

            Content = new RadListView
            {
                SelectionMode = SelectionMode.None,
                IsItemsReorderEnabled = true,
                ItemsSource = items,
                ItemTemplate = new DataTemplate(typeof(ItemView)),

                ItemStyle = WhiteBG,
                PressedItemStyle = YellowBG,
                SelectedItemStyle = RedBG,
                ReorderItemStyle = BlueBG,
            };
        }

        private class Item
        {
            public string Name { get; }

            public Item(string name)
            {
                Name = name;
            }
        }

        private class ItemView : ListViewTemplateCell
        {
            public ItemView()
            {
                var checkbox = new CheckBox
                {
                    VerticalOptions = LayoutOptions.Center
                };

                var label = new Label
                {
                    VerticalOptions = LayoutOptions.Center
                };

                label.SetBinding(Label.TextProperty, nameof(Item.Name));

                View = new StackLayout
                {
                    BackgroundColor = Color.Transparent,
                    Orientation = StackOrientation.Horizontal,
                    Children =
                    {
                        checkbox,
                        label
                    }
                };
            }
        }
    }

1 comment
ADMIN
Yana
Posted on: 19 Dec 2019 13:22

Hello Aaron,

Thank you for providing the sample and reporting this issue.  Indeed, there is an issue related to these properties - ReorderItemStyle and PressedItemStyle are not applied on iOS ( although the selection is disabled, PressedItemStyle should be applied at the time the user taps/holds the item).

I have updated the status of the feedback item, as I confirm it is a valid bug report. For the moment, I cannot commit to a certain timeframe for providing a fix, please follow this item to get notified on any status changes.

I've also updated your points for your involvement on this.

Regards,
Yana
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