To perform it you can create a class like a name my_Button
without any item in it and at the top of this class define attribute like this:
[Editor(typeof(UIEditor_List), typeof(UITypeEditor)), TypeConverter(typeof(TypeConv_List)), Serializable]
public class my_Button
{
}
UIEditor_List
class for performing of the class and TypeConv_List
is the name of it and these value can define as below:
public class TypeConv_List : TypeConverter
{
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
return "Click ...";
}
}
public class UIEditor_List : UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;
}
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
my_Button list = value as my_Button;
list = new my_Button();
return list;
}
}
and at the last foreach
property of your item class that want to be button define like this
public my_Button Read_Mode { get; set; } = new my_Button();
and in the propertygrid
define event name propertyGrid1_PropertyValueChanged
and define every change you want to do like below:
private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
{
if (propertyGrid1.SelectedGridItem.Label == nameof(filr_dir.Read_Mode))
{
System.Diagnostics.Process.Start("explorer.exe", "notpad.txt");
}
}
PropertyGrid
, or something else? (You didn't specify which UI framework you're using.) – Glossography