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

Empty ListView

2 Answers 273 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Cleanwatts
Top achievements
Rank 1
Cleanwatts asked on 20 Mar 2018, 12:14 PM

When the RadListView is empty (no items) it shows the text "No data" in the top left corner.

How can I customize (change text, position, style or hide) that text?

2 Answers, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 22 Mar 2018, 04:29 PM
Hi, 

The behavior you are referring to should be present only in the UWP platform. You can easily avoid it by applying the following custom renderer:

[assembly: ExportRenderer(typeof(Telerik.XamarinForms.DataControls.RadListView), typeof(CustomListViewRenderer))]
namespace RadListViewNoData.UWP.CustomListViewRenderer
{
    class CustomListViewRenderer : Telerik.XamarinForms.DataControlsRenderer.UWP.ListViewRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<RadListView> e)
        {
            base.OnElementChanged(e);
            this.Control.EmptyContent = string.Empty;
        }
    }
}

Please give it a try and update the thread whether it works for you. I have attached a sample for your reference as well.

Have a great rest of the week.

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
Accepted
Stefan Nenchev
Telerik team
answered on 22 Mar 2018, 04:33 PM
Hello, 

Actually, the native control in UWP has a dedicated property on whether to show the content or not, so you can directly disable it this way:

protected override void OnElementChanged(ElementChangedEventArgs<RadListView> e)
     {
         base.OnElementChanged(e);
         this.Control.EmptyContentDisplayMode = Telerik.UI.Xaml.Controls.Data.EmptyContentDisplayMode.None;
     }

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