Creating a Table/Grid that functions like 'Properties' window in VS.NET

  • Thread starter Thread starter JMe9ka
  • Start date Start date
J

JMe9ka

I've been gnawing at this problem for the past two days with little
progress. My intent is to create a table or grid that looks and
functions like the Properties window in Visual Studio.NET. I'm not sure
if anyone has been able to accomplish this in a relatively non-trivial
manner, but if someone has, please let me know. My deadline is
approaching.
 
You can do it with a normal grid or table control. Just have to set the
styles and also, for drop downs and/or buttons, use the
Controls.Add(control) to add the specified control to the cell.

HTH,

Bill P.
 
JMe9ka,
Have you considered using the actual properties control from VS.NET?

Its available for use in your projects, its just that by default it is not
in the toolbox. You can add it to your toolbox.

See: System.Windows.Forms.PropertyGrid.

Hope this helps
Jay
 
So when you say 'normal grid' control, you're referring to a DataGrid,
right?

And with this process, I'd be able to create something like the
following?


<Attribute> <Name>
Name Robert (text)
Language English (selected from dropdown list)
Active Yes (selected from dropdownlist)
Nickname Bob (text)
etc..


Thanks for your help.
 
Datagrid or table. Although, with a datagrid, you would have to bind it, but
yes, that is basically it. You could bind the attributes in the first column
and the controls in the second. When you are binding the grid, you have to
trap the ItemCreated event in order to determine where you are in the
binding and where you are row-wise in order to know what kind of control to
add. something like this..

private void _ItemCreated(object sender, DataGridItemEventArgs e)
{
switch(some var here)
{
case "AddTextBox":
//add the textbox control here...
break;
}
}

I'm sure there are other loops, datareaders or whatever, that you could loop
through for your attribute/control values.

HTH,

Bill P.
 
Back
Top