Good day! I'm trying to set up a condition on a propertygrid where if a regex is not match it will not leave the propertyitem on propertygrid
if (Regex Condition)
{
PropertyGrid PropertyGrid = sender as PropertyGrid;
TextBox Name = SelectedPropertyItem.PropertyEditor as TextBox;
Name.Background = Brushes.Red;
Name.Focus();
MessageBox.Show("Invalid Regex");
}
but on this code, it seems like the .Focus() doesn't seem to work. Is there a way to programmatically set focus on a propertygrid's propertyitem?
Thank you!