[...]
i only keep posting this conversation with myself in the hopes someone
will
chime in and show me where it can be improved.
On the WPF-specific points (such as the best way to identify the
double-clicked column), you may find this forum limited in expertise.
Some of the .NET GUI controls have built-in functions for mapping mouse
coordinates to specific elements of the control. Not being that familiar
with the WPF controls, I don't know if that's present for your GridView,
but it might be.
As far as the mapping from column number to FunctionInfo property goes, a
common approach for that scenario is to use a dictionary rather than
specifically-named properties. That way, you can always retrieve the
property by name directly.
Alternatively, arguably you shouldn't be accessing the properties by name
anyway, since the name you're getting is from the UI, which should have
little or nothing to do with the names of things in code. Instead, have a
way of mapping directly from the column number or the column object
itself; for example, maintain an array that is parallel to the column
order, or do a "decoration" of sorts by creating a dictionary mapping the
GridViewColumn object itself to the necessary information, rather than its
string.
Either way, that allows you to manipulate the text displayed to the user
without that affecting the underlying code.
As far as what the mapping from the column goes to, that can be the name
of the property or an enum, or some other way of identifying the
property. To get from that to a property, the simplest approach would be
to just use a "switch" statement.
So, taking all that together, you might get something that looks a little
like this:
Initialized somewhere for the class:
string[] rgstrProperties = { "Name", "Signature", "Filename" };
Then, after calculating "columnNumber":
switch (rgstrProperties[columnNumber])
{
case "Name":
Debug.Print(fi.Name);
break;
case "Signature":
Debug.Print(fi.Signature);
break;
case "Filename":
Debug.Print(fi.Filename);
break;
}
Of course, the above is most useful if you anticipate having to rearrange
the columns. Then you only have to change the string[] with the names,
rather than all the rest of the code that maps the columns to the
properties.
But if you want, you can skip the string[] altogether and just embed the
mapping in your switch statement:
switch (columnNumber)
{
case 0:
Debug.Print(fi.Name);
break;
case 1:
Debug.Print(fi.Signature);
break;
case 2:
Debug.Print(fi.Filename);
break;
}
Pete