0

I'd like to set up a multidimensional list. For reference, I am creating control with property grid for changing its properties.

I am adding controls dynamically. For example, I am adding example no.of stack panels dynamically. Inside the stack panel i am adding no.of elements for example textbox control with property grid.

If i am adding all textbox in 1 stack panel means i can use List and i can get it based on index. But i want to add the property considering the stack panel also.

Here is the data I want to Add:

List
(
 [0] => List
  (
    ([0] => List
     (
       [0] => FillColor
       [1] => BorderColor
       [2] => BorderWidth
       [3] => Text
       [4] => FontSize
       [5] => FontFamily
      )
   )
[1] => List
    (
 And so on....

I can get the textbox properties collections based on the following.

internal class PropertiesCollection : List<textBoxPropertiesProperties>
{
}

internal class textBoxProperties
{
}

PropertiesCollection collection = new PropertiesCollection ();
textBoxProperties properties=new textBoxProperties();
collection.Add(textBoxProperties);

textBox1 properties---> collection[0]
textBox2 properties ....> collection[1]

But i want to get it based on in which stack panel its placed. I need something like

textBoxProperties[stackpanel1][textbox1]
textBoxProperties[stackpanel1][textbox2]
textBoxProperties[stackpanel2][textbox1]
textBoxProperties[stackpanel2][textbox2].

How can i get this?

4

1 回答 1

0

Rather than creating your own hierarchy, you could just use the built in tree structures in WPF - look up the VisualTreeHelper class or see this article: http://www.codeproject.com/Articles/21495/Understanding-the-Visual-Tree-and-Logical-Tree-in

于 2012-07-08T18:05:59.307 回答