示例#1
0
        /// <summary>
        /// 通过指定参数集合获取 TabItem 实例
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public static TabItem Create(Dictionary <string, object> parameters)
        {
            var item = new TabItem();
            var _    = item.SetParametersAsync(ParameterView.FromDictionary(parameters));

            return(item);
        }
示例#2
0
        /// <summary>
        /// 通过指定参数集合获取 TabItem 实例
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public static TabItem Create(Dictionary <string, object?> parameters)
        {
            var item = new TabItem();

            if (parameters.TryGetValue(nameof(Url), out var url))
            {
                parameters[nameof(Url)] = url?.ToString()?.TrimStart('/');
            }
            var _ = item.SetParametersAsync(ParameterView.FromDictionary(parameters));

            return(item);
        }
示例#3
0
 private void AddTabByUrl(string url)
 {
     if (RouteTable.TryGetValue(url, out var comp))
     {
         var item       = new TabItem();
         var parameters = new Dictionary <string, object>
         {
             [nameof(TabItem.Text)]         = Options.TabItemText ?? string.Empty,
             [nameof(TabItem.Url)]          = url,
             [nameof(TabItem.IsActive)]     = true,
             [nameof(TabItem.ChildContent)] = new RenderFragment(builder =>
             {
                 builder.OpenComponent(0, comp);
                 builder.CloseComponent();
             })
         };
         var _ = item.SetParametersAsync(ParameterView.FromDictionary(parameters));
         Add(item);
     }
 }