/// <summary>
        /// Configures a named template.
        /// </summary>
        /// <param name="templateName"></param>
        /// <param name="templateOptions"></param>
        /// <returns></returns>
        public BlazorContextMenuSettingsBuilder ConfigureTemplate(string templateName, Action <BlazorContextMenuTemplate> templateOptions)
        {
            var template = new BlazorContextMenuTemplate();

            templateOptions(template);
            _settings.Templates.Add(templateName, template);
            return(this);
        }
Example #2
0
        /// <summary>
        /// Configures a named template.
        /// </summary>
        /// <param name="templateName"></param>
        /// <param name="templateOptions"></param>
        /// <returns></returns>
        public BlazorContextMenuSettingsBuilder ConfigureTemplate(string templateName, Action <BlazorContextMenuTemplate> templateOptions)
        {
            if (_settings.Templates.ContainsKey(templateName))
            {
                throw new Exception($"Template '{templateName}' is already defined");
            }
            var template = new BlazorContextMenuTemplate();

            templateOptions(template);

            _settings.Templates.Add(templateName, template);
            return(this);
        }