Empty ListView

3 posts, 1 answers
  1. VPS
    VPS avatar
    30 posts
    Member since:
    Jan 2015

    Posted 20 Mar 2018 Link to this post

    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. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    665 posts

    Posted 22 Mar 2018 Link to this post

    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
  3. Answer
    Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    665 posts

    Posted 22 Mar 2018 Link to this post

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