Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the logic about the attribute [RefreshProperties(RefreshProperties.All)] on PropertyGridView.cs #12356

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4018,7 +4018,10 @@ private void Refresh(bool fullRefresh, int startRow, int endRow)
if (oldLength > 0 && !_flags.HasFlag(Flags.NoDefault))
{
_positionData = CaptureGridPositionData();
CommonEditorHide(true);
if (!fullRefresh)
{
CommonEditorHide(true);
}
}

UpdateHelpAttributes(_selectedGridEntry, newEntry: null);
Expand Down Expand Up @@ -4299,17 +4302,10 @@ private void SelectRow(int row)
return;
}

bool newRow = false;
int oldSelectedRow = _selectedRow;
if (_selectedRow != row || !gridEntry.Equals(_selectedGridEntry))
if (_selectedRow != row || (_selectedGridEntry is not null && !gridEntry.Equals(_selectedGridEntry)))
{
CommonEditorHide();
newRow = true;
}

if (!newRow)
{
CloseDropDown();
}

Rectangle rect = GetRectangle(row, RowValue);
Expand Down Expand Up @@ -4400,7 +4396,7 @@ private void SelectRow(int row)
_selectedGridEntry.HasFocus = FocusInside;
}

if (!_flags.HasFlag(Flags.IsNewSelection))
if (!_flags.HasFlag(Flags.IsNewSelection) && !_flags.HasFlag(Flags.InPropertySet))
{
Focus();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,35 @@ private void CreateDesignSurface(int n)
// - create some Controls at DesignTime
TextBox t1 = surface.CreateControl<TextBox>(new Size(200, 23), new Point(172, 12));
Button b1 = surface.CreateControl<Button>(new Size(200, 40), new Point(172, 63));
CustomButton b2 = surface.CreateControl<CustomButton>(new Size(200, 40), new Point(100, 200));
CustomButton b2 = surface.CreateControl<CustomButton>(new Size(200, 40), new Point(172, 200));
b1.Text = "I'm the first Button";
b2.Text = "I'm the second Button";
b1.BackColor = Color.LightGray;
b2.BackColor = Color.LightGreen;

RadioButton rb1 = surface.CreateControl<RadioButton>(new Size(120, 22), new Point(12, 21));
RadioButton rb1 = surface.CreateControl<RadioButton>(new Size(120, 22), new Point(12, 10));
rb1.Text = "Check me!";
RadioButton rb2 = surface.CreateControl<RadioButton>(new Size(120, 22), new Point(12, 50));
RadioButton rb2 = surface.CreateControl<RadioButton>(new Size(120, 22), new Point(12, 35));
rb2.Text = "No, check me!";
rb2.Checked = true;

Panel pnl = surface.CreateControl<Panel>(new Size(130, 100), new Point(12, 21));
CheckBox checkbox1 = surface.CreateControl<CheckBox>(new Size(120, 22), new Point(12, 60));
checkbox1.Text = "I'm Unchecked!";
CheckBox checkbox2 = surface.CreateControl<CheckBox>(new Size(120, 22), new Point(12, 85));
checkbox2.Text = "I'm Indeterminate!";
checkbox2.AutoSize = true;
checkbox2.CheckState = CheckState.Indeterminate;
CheckBox checkbox3 = surface.CreateControl<CheckBox>(new Size(120, 22), new Point(12, 110));
checkbox3.Text = "I'm Checked!";
checkbox3.CheckState = CheckState.Checked;

Panel pnl = surface.CreateControl<Panel>(new Size(140, 140), new Point(12, 12));
pnl.BackColor = Color.Aquamarine;
rb1.Parent = pnl;
rb2.Parent = pnl;
checkbox1.Parent = pnl;
checkbox2.Parent = pnl;
checkbox3.Parent = pnl;

Label l1 = surface.CreateControl<Label>(new Size(100, 25), new Point(12, 12));
Label l2 = surface.CreateControl<Label>(new Size(120, 25), new Point(12, 12));
Expand All @@ -154,7 +167,7 @@ private void CreateDesignSurface(int n)
l1.Parent = sct.Panel1;
l2.Parent = sct.Panel2;

PictureBox pb1 = surface.CreateControl<PictureBox>(new Size(64, 64), new Point(24, 166));
PictureBox pb1 = surface.CreateControl<PictureBox>(new Size(64, 64), new Point(12, 176));
pb1.Image = new Icon("painter.ico").ToBitmap();

ContextMenuStrip cm1 = surface.CreateComponent<ContextMenuStrip>();
Expand Down Expand Up @@ -333,7 +346,7 @@ private void CreateDesignSurface(int n)
splitter.BackColor = Color.Green;
splitter.Dock = DockStyle.Bottom;

Panel panel = surface.CreateControl<Panel>(new(0, tabPage6.Height/2), new(0, 0));
Panel panel = surface.CreateControl<Panel>(new(0, tabPage6.Height / 2), new(0, 0));
panel.Dock = DockStyle.Bottom;
NumericUpDown numericUpDown = surface.CreateControl<NumericUpDown>(new(50, 10), new(10, 10));
panel.Controls.Add(numericUpDown);
Expand Down