add controls on load
- hopefully fixes initial focus being on confirm button
This commit is contained in:
@@ -7,6 +7,8 @@ namespace Pilz.UI.Telerik.Dialogs;
|
|||||||
|
|
||||||
public partial class RadFlyoutBase : UserControl
|
public partial class RadFlyoutBase : UserControl
|
||||||
{
|
{
|
||||||
|
private bool addedControlsToUi;
|
||||||
|
|
||||||
private RadButton radButton_Cancel;
|
private RadButton radButton_Cancel;
|
||||||
private RadButton radButton_Confirm;
|
private RadButton radButton_Confirm;
|
||||||
private TableLayoutPanel tableLayoutPanel_ActionPanel;
|
private TableLayoutPanel tableLayoutPanel_ActionPanel;
|
||||||
@@ -152,6 +154,7 @@ public partial class RadFlyoutBase : UserControl
|
|||||||
ColumnCount = 3,
|
ColumnCount = 3,
|
||||||
RowCount = 1,
|
RowCount = 1,
|
||||||
};
|
};
|
||||||
|
tableLayoutPanel_ActionPanel.SuspendLayout();
|
||||||
tableLayoutPanel_ActionPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
|
tableLayoutPanel_ActionPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
|
||||||
tableLayoutPanel_ActionPanel.ColumnStyles.Add(new ColumnStyle());
|
tableLayoutPanel_ActionPanel.ColumnStyles.Add(new ColumnStyle());
|
||||||
tableLayoutPanel_ActionPanel.ColumnStyles.Add(new ColumnStyle());
|
tableLayoutPanel_ActionPanel.ColumnStyles.Add(new ColumnStyle());
|
||||||
@@ -169,6 +172,7 @@ public partial class RadFlyoutBase : UserControl
|
|||||||
ColumnCount = 1,
|
ColumnCount = 1,
|
||||||
RowCount = 1
|
RowCount = 1
|
||||||
};
|
};
|
||||||
|
tableLayoutPanel_TitlePanel.SuspendLayout();
|
||||||
tableLayoutPanel_TitlePanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
tableLayoutPanel_TitlePanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||||
tableLayoutPanel_TitlePanel.Controls.Add(radLabel_Title, 0, 0);
|
tableLayoutPanel_TitlePanel.Controls.Add(radLabel_Title, 0, 0);
|
||||||
tableLayoutPanel_TitlePanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
|
tableLayoutPanel_TitlePanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
|
||||||
@@ -177,9 +181,26 @@ public partial class RadFlyoutBase : UserControl
|
|||||||
// RadFlyoutBase
|
// RadFlyoutBase
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
Controls.Add(tableLayoutPanel_TitlePanel);
|
|
||||||
Controls.Add(tableLayoutPanel_ActionPanel);
|
|
||||||
Size = new Size(300, 150);
|
Size = new Size(300, 150);
|
||||||
|
|
||||||
|
tableLayoutPanel_TitlePanel.ResumeLayout(false);
|
||||||
|
tableLayoutPanel_ActionPanel.ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLoad(EventArgs e)
|
||||||
|
{
|
||||||
|
if (!addedControlsToUi)
|
||||||
|
{
|
||||||
|
SuspendLayout();
|
||||||
|
Controls.Add(tableLayoutPanel_ActionPanel);
|
||||||
|
tableLayoutPanel_ActionPanel.BringToFront();
|
||||||
|
Controls.Add(tableLayoutPanel_TitlePanel);
|
||||||
|
tableLayoutPanel_TitlePanel.BringToFront();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
addedControlsToUi = true;
|
||||||
|
}
|
||||||
|
base.OnLoad(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void FlyoutDialogBase_ParentChanged(object? sender, EventArgs e)
|
protected virtual void FlyoutDialogBase_ParentChanged(object? sender, EventArgs e)
|
||||||
|
|||||||
@@ -84,8 +84,6 @@ public partial class FlyoutBase : UserControl
|
|||||||
[MemberNotNull(nameof(button_Accept))]
|
[MemberNotNull(nameof(button_Accept))]
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
SuspendLayout();
|
|
||||||
|
|
||||||
// button_Accept
|
// button_Accept
|
||||||
button_Accept = new Button
|
button_Accept = new Button
|
||||||
{
|
{
|
||||||
@@ -153,14 +151,22 @@ public partial class FlyoutBase : UserControl
|
|||||||
// FlyoutBase
|
// FlyoutBase
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
Controls.Add(tableLayoutPanel_ActionPanel);
|
|
||||||
Controls.Add(tableLayoutPanel_TitlePanel);
|
|
||||||
Size = new Size(300, 150);
|
Size = new Size(300, 150);
|
||||||
|
|
||||||
tableLayoutPanel_TitlePanel.ResumeLayout(false);
|
tableLayoutPanel_TitlePanel.ResumeLayout(false);
|
||||||
tableLayoutPanel_ActionPanel.ResumeLayout(false);
|
tableLayoutPanel_ActionPanel.ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLoad(EventArgs e)
|
||||||
|
{
|
||||||
|
SuspendLayout();
|
||||||
|
Controls.Add(tableLayoutPanel_ActionPanel);
|
||||||
|
tableLayoutPanel_ActionPanel.BringToFront();
|
||||||
|
Controls.Add(tableLayoutPanel_TitlePanel);
|
||||||
|
tableLayoutPanel_TitlePanel.BringToFront();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
|
base.OnLoad(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FlyoutBase_ParentChanged(object? sender, EventArgs e)
|
private void FlyoutBase_ParentChanged(object? sender, EventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user