DataGridView <-> PropertyGrid data binding
-
Any and all, Try not to flame me, I'm a EE that writes C# sparingly, so go easy on me. I have an application with a property grid and a data grid view. The data grid represents a register table of an ASIC. A register location inside the ASIC controls some portion of the ASIC. The property grid contains the same control as the register table, only in a more easy to use manner, as you can imagine. The user can alter a property which in turn writes a register in the ASIC, this register change fires the data grid to update, via reading all the registers in the ASIC. The reverse is also possible: the user may manually change a register which updates the data grid and then the property grid is updated. If I explained myself well enough, the data grid and property grids are tied together via control of the ASIC. Currently, if a property is changed I have a big case statement with the property name as the switch. Depending on which property is updated I then alter the specific register. Currently, if a register is manually written (via the data grid) I have another big case statement with the register address as the switch. I then update the necessary property in the property grid. My question is there must be a better way of doing this. As you can imagine every time I port my software to a new or different ASIC I have to re-write ~1000 lines of code. Also a property can affect multiple registers, which in turn can affect other properties, i.e. Prop A Changed->Write Register B, C, & D->Update data grid->Register D Changed->Update property A & E->etc. These "callbacks" can get long & slow down my application. What can I do to make this process more seemless? FYI I can't completely remove the data grid view, because of other reasons, even though I believe users use the PropertyGrid > 98% of the time. Thanks, --RB