-
-
Notifications
You must be signed in to change notification settings - Fork 382
Expand file tree
/
Copy pathAutoCompleteItems.cs
More file actions
60 lines (52 loc) · 1.52 KB
/
AutoCompleteItems.cs
File metadata and controls
60 lines (52 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License
// See the LICENSE file in the project root for more information.
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
using Microsoft.AspNetCore.Components.Rendering;
namespace BootstrapBlazor.Components;
/// <summary>
/// AutoCompleteItems component
/// </summary>
class AutoCompleteItems : IComponent
{
/// <summary>
/// Gets or sets the child content
/// </summary>
[Parameter, NotNull]
public RenderFragment? ChildContent { get; set; }
private RenderHandle _renderHandle;
/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="renderHandle"></param>
public void Attach(RenderHandle renderHandle)
{
_renderHandle = renderHandle;
}
/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="parameters"></param>
/// <returns></returns>
public Task SetParametersAsync(ParameterView parameters)
{
parameters.SetParameterProperties(this);
RenderContent();
return Task.CompletedTask;
}
/// <summary>
/// Render method
/// </summary>
public void RenderContent()
{
_renderHandle.Render(BuildRenderTree);
}
/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="builder"></param>
private void BuildRenderTree(RenderTreeBuilder builder)
{
builder.AddContent(0, ChildContent);
}
}