Hello,
I must note that we do not support inheriting our components and we cannot guarantee such hacks will not cause issues.
Regards,
Marin Bratanov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Here is my take before it gets implemented:
using HaSaM.Systems;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Telerik.Blazor.Components;
namespace HaSaM.Web.Components.Interactions
{
public class TelerikNotification :
Telerik.Blazor.Components.TelerikNotification
{
public TelerikNotification()
{
Type type = typeof(Telerik.Blazor.Components.TelerikNotification);
notifications = type.CreatePropertyGetMethodDelegate<List<NotificationModel>>(nameof(Notifications), BindingFlags.NonPublic, this);
hideNotification = type.CreateMethodDelegate<Action<NotificationModel>>(nameof(HideNotification), BindingFlags.NonPublic, this);
}
public IEnumerable<NotificationModel> Notifications => notifications();
public bool Hide(NotificationModel model)
{
bool found = Notifications.Contains(model);
if (found)
HideNotification(model);
return found;
}
private void HideNotification(NotificationModel notification) => hideNotification(notification);
private readonly Func<List<NotificationModel>> notifications;
private readonly Action<NotificationModel> hideNotification;
}
}
public static Func<T> CreatePropertyGetMethodDelegate<T>(this Type type, string name, BindingFlags bindingAttr = BindingFlags.Public, object instance = null)