Skip to content

Commit a520c8f

Browse files
committed
1.1.9.1
1 parent 4cbbd9b commit a520c8f

5 files changed

Lines changed: 27 additions & 3 deletions

File tree

87.2 KB
Binary file not shown.
-87 KB
Binary file not shown.

Blazor.WebForm.Components/Base/ControlParameterViewComponentExtensions.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,19 @@ public static ITemplate GetTemplateProperty<TValue>(this IParameterViewComponent
169169
}
170170
}
171171

172+
public static ITemplate GetInsertTemplateProperty<TValue>(this IParameterViewComponent component, RenderFragment<TValue> value)
173+
where TValue : new()
174+
{
175+
if (value != null)
176+
{
177+
return new RenderFragmentBindableTemplateBuilder<TValue>(value, ExtractValues, () => new TValue());
178+
}
179+
else
180+
{
181+
return null;
182+
}
183+
}
184+
172185
private static IOrderedDictionary ExtractValues<TValue>(Control container, TValue context)
173186
{
174187
return new OrderedDictionary().Apply(() => context);

Blazor.WebForm.Components/Blazor.WebForm.Components.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>net5.0</TargetFramework>
55
<SignAssembly>true</SignAssembly>
66
<AssemblyOriginatorKeyFile>Blazor.WebForm.Components.pfx</AssemblyOriginatorKeyFile>
7-
<Version>1.1.9.0</Version>
7+
<Version>1.1.9.1</Version>
88
<RootNamespace>asp</RootNamespace>
99
<Copyright>Jurio li</Copyright>
1010
<AssemblyName>Blazor.WebForm.Components</AssemblyName>
@@ -17,7 +17,7 @@
1717

1818
<ItemGroup>
1919
<PackageReference Include="Applied" Version="1.2.1.5" />
20-
<PackageReference Include="Blazor.WebForm.UI" Version="1.1.9" />
20+
<PackageReference Include="Blazor.WebForm.UI" Version="1.1.9.1" />
2121
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.8" />
2222
</ItemGroup>
2323

Blazor.WebForm.Components/Inner/Common/InsertItemTemplate.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Blazor.WebForm.UI.PropertyComponents;
1+
using Blazor.WebForm.UI;
2+
using Blazor.WebForm.UI.PropertyComponents;
23
using System;
34
using System.Collections.Generic;
45
using System.Linq;
@@ -8,6 +9,7 @@
89
namespace Microsoft.AspNetCore.Components
910
{
1011
public partial class InsertItemTemplate<TItem> : BindableTemplatePropertyComponent<object, TItem>, ICommonPropertyComponent
12+
where TItem : new()
1113
{
1214
protected override string PropertyName
1315
{
@@ -16,5 +18,14 @@ protected override string PropertyName
1618
return nameof(InsertItemTemplate<TItem>);
1719
}
1820
}
21+
22+
protected override KeyValuePair<string, object>? OnConvertParameter(KeyValuePair<string, object> parameter)
23+
{
24+
if (parameter.Key == nameof(this.ChildContent))
25+
{
26+
return new KeyValuePair<string, object>(this.PropertyName, this.GetInsertTemplateProperty(this.ChildContent));
27+
}
28+
return base.OnConvertParameter(parameter);
29+
}
1930
}
2031
}

0 commit comments

Comments
 (0)