Skip to content

Commit

Permalink
2.4.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jurioli committed Jul 20, 2024
1 parent cbecd8b commit af57456
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
Binary file added Blazor.WebForm.Components.2.4.1.1.nupkg
Binary file not shown.
Binary file removed Blazor.WebForm.Components.2.4.1.nupkg
Binary file not shown.
6 changes: 3 additions & 3 deletions Blazor.WebForm.Components/Blazor.WebForm.Components.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Blazor.WebForm.Components.pfx</AssemblyOriginatorKeyFile>
<Version>2.4.1.0</Version>
<Version>2.4.1.1</Version>
<RootNamespace>asp</RootNamespace>
<Copyright>Jurio li</Copyright>
<AssemblyName>Blazor.WebForm.Components</AssemblyName>
Expand All @@ -17,8 +17,8 @@

<ItemGroup>
<PackageReference Include="Applied" Version="1.2.1.8" />
<PackageReference Include="Blazor.WebForm.UI" Version="2.4.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.4" />
<PackageReference Include="Blazor.WebForm.UI" Version="2.4.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.7" />
</ItemGroup>

<ItemGroup>
Expand Down
19 changes: 19 additions & 0 deletions Blazor.WebForm.Components/Inner/ListControl/ListItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI;

namespace asp
{
Expand All @@ -22,18 +23,36 @@ public class ListItem : PropertyComponent<System.Web.UI.WebControls.ListControl>
[Parameter]
public string Value { get; set; }

[Parameter(CaptureUnmatchedValues = true)]
public IReadOnlyDictionary<string, object> Attributes { get; set; }

[Parameter]
public RenderFragment ChildContent { get; set; }

protected internal override void SetInnerProperty(IReadOnlyDictionary<string, object> parameters)
{
System.Web.UI.WebControls.ListItem item = new System.Web.UI.WebControls.ListItem();
item.Apply(() => parameters);
SetAttributes(item, this.Attributes);
if (parameters.ContainsKey(nameof(this.ChildContent)) && this.ChildContent != null)
{
Blazor.WebForm.UI.RenderUtility.SetContentString(item, this.ChildContent);
}
this.Owner.Items.Add(item);
}

private static void SetAttributes(IAttributeAccessor accessor, IReadOnlyDictionary<string, object> attributes)
{
if (attributes != null)
{
foreach (KeyValuePair<string, object> attribute in attributes)
{
if (attribute.Value is string value)
{
accessor.SetAttribute(attribute.Key, value);
}
}
}
}
}
}

0 comments on commit af57456

Please sign in to comment.