MAUI – Migrate TableView Renderer to Handler to add FooterText

We are migrating an XF app to MAUI. In XF you cannot add a Footer to a TableSection or Table. This is still not possible to do in MAUI so I need to migrate our custom TableView control and Renderers.

It was my understanding that Renderers were gone but looking at the MAUI repo in GitHub
there seem to live on inside the Handlers.Compatibility namespace.

Our Xamarin Forms Renderer looked like this

public class BreatheTableViewRenderer : TableViewRenderer
    {
        /// <summary>
        /// Raises the <see cref="E:ElementChanged" /> event.
        /// </summary>
        /// <param name="e">The <see cref="ElementChangedEventArgs{TableView}"/> instance containing the event data.</param>
        protected override void OnElementChanged(ElementChangedEventArgs<TableView> e)
        {
            base.OnElementChanged(e);
            if (this.Control == null)
            {
                return;
            }

            var tableView = this.Control as UITableView;
            var formsTableView = this.Element as TableView;
            tableView.WeakDelegate = new BreatheTableViewModelRenderer(formsTableView);
        }

        private class BreatheTableViewModelRenderer : TableViewModelRenderer
        {
            private BreatheTableView view;

            public BreatheTableViewModelRenderer(TableView model)
                : base(model)
            {
                this.view = model as BreatheTableView;
            }

            protected BreatheTableView BreatheTableView { get => this.view; private set => this.view = value; }

            public override UIView GetViewForFooter(UITableView tableView, nint section)
            {
                // Do we have a TableView Footer and if so is this is the last section
                if (this.BreatheTableView.FooterText != null && section == tableView.NumberOfSections() - 1)
                {
                    // ... if it is use that last section to display the footer
                    return this.GetViewForTableFooter(this.BreatheTableView.FooterText);
                }

                TableSection tblSection = this.View.Root[(int)section];

                string sectionFooterText = BreatheTableView.GetSectionFooterText(tblSection);

                if (string.IsNullOrEmpty(sectionFooterText) == false)
                {
                    return this.GetViewForTableFooter(sectionFooterText);
                }

                return null;
            }

            private UIView GetViewForTableFooter(string text)
            {
                var footerView = new UITextView()
                {
                    Text = text,
                    Font = UIFont.PreferredFootnote,
                    TextContainerInset = new UIEdgeInsets(5, 10, 5, 10),
                    TextColor = UIColor.LightGray,
                    BackgroundColor = UIColor.Clear,
                    Editable = false,
                };

                if (this.BreatheTableView.FooterAlignment == TextAlignment.Start)
                {
                    footerView.TextAlignment = UITextAlignment.Left;
                }
                else if (this.BreatheTableView.FooterAlignment == TextAlignment.Center)
                {
                    footerView.TextAlignment = UITextAlignment.Center;
                }
                else if (this.BreatheTableView.FooterAlignment == TextAlignment.End)
                {
                    footerView.TextAlignment = UITextAlignment.Right;
                }

                return footerView;
            }
        }
    }

I cannot see how to do the MAUI equivalent of

tableView.WeakDelegate = new BreatheTableViewModelRenderer(formsTableView);
  1. How do I implment my own GetViewForFooter
  2. Are renderers gone in MAUI?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật