Add named Panel1/Panel2 slots to SplitContainer
This commit is contained in:
Родитель
7ede0f2c08
Коммит
4a55c28a7b
|
@ -1,5 +1,6 @@
|
|||
using Emblazon;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Rendering;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace BlinForms.Framework.Controls
|
||||
|
@ -11,7 +12,9 @@ namespace BlinForms.Framework.Controls
|
|||
NativeControlRegistry<IWindowsFormsControlHandler>.RegisterNativeControlComponent<SplitContainer, BlazorSplitContainer>();
|
||||
}
|
||||
|
||||
[Parameter] public RenderFragment ChildContent { get; set; }
|
||||
[Parameter] public RenderFragment Panel1 { get; set; }
|
||||
[Parameter] public RenderFragment Panel2 { get; set; }
|
||||
|
||||
[Parameter] public Orientation? Orientation { get; set; }
|
||||
[Parameter] public int? SplitterDistance { get; set; }
|
||||
|
||||
|
@ -29,7 +32,18 @@ namespace BlinForms.Framework.Controls
|
|||
}
|
||||
}
|
||||
|
||||
protected override RenderFragment GetChildContent() => ChildContent;
|
||||
protected override RenderFragment GetChildContent() => RenderChildContent;
|
||||
|
||||
private void RenderChildContent(RenderTreeBuilder builder)
|
||||
{
|
||||
builder.OpenComponent<SplitterPanel1>(0);
|
||||
builder.AddAttribute(1, nameof(SplitterPanel1.ChildContent), Panel1);
|
||||
builder.CloseComponent();
|
||||
|
||||
builder.OpenComponent<SplitterPanel2>(2);
|
||||
builder.AddAttribute(3, nameof(SplitterPanel2.ChildContent), Panel2);
|
||||
builder.CloseComponent();
|
||||
}
|
||||
|
||||
class BlazorSplitContainer : System.Windows.Forms.SplitContainer, IWindowsFormsControlHandler
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace BlinForms.Framework.Controls
|
||||
{
|
||||
public class SplitterPanel1 : SplitterPanelBase
|
||||
internal class SplitterPanel1 : SplitterPanelBase
|
||||
{
|
||||
static SplitterPanel1()
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace BlinForms.Framework.Controls
|
||||
{
|
||||
public class SplitterPanel2 : SplitterPanelBase
|
||||
internal class SplitterPanel2 : SplitterPanelBase
|
||||
{
|
||||
static SplitterPanel2()
|
||||
{
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
Anchor="@(System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)"
|
||||
Orientation="System.Windows.Forms.Orientation.Vertical"
|
||||
SplitterDistance="350">
|
||||
<SplitterPanel1>
|
||||
<Panel1>
|
||||
<Label Top="8" Left="8" Text="Todo Items" />
|
||||
<Panel Top="40" Left="8" Width="350" Height="450" BackColor="SystemColors.ControlDark">
|
||||
<TodoList />
|
||||
</Panel>
|
||||
</SplitterPanel1>
|
||||
<SplitterPanel2>
|
||||
</Panel1>
|
||||
<Panel2>
|
||||
<Label Top="8" Left="8" Text="Counter" />
|
||||
<Panel Top="40" Left="8">
|
||||
<Button Text="Toggle counter" OnClick="@ToggleCounterVisible" />
|
||||
|
@ -19,7 +19,7 @@
|
|||
</Panel>
|
||||
}
|
||||
</Panel>
|
||||
</SplitterPanel2>
|
||||
</Panel2>
|
||||
</SplitContainer>
|
||||
|
||||
@code
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"sdk": {
|
||||
"version": "3.0.100-preview8-013656"
|
||||
"version": "3.0.100-preview9-014004"
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче