With Wpf familiar recently, the stage of falling in love quickly passed and began bytovuha. You need to get control of something like a PropertyGrid, but without using attributes.

At the input, I have a Dictionary<string,Type> setupScetc h (parameter name-parameter type) and a validation method for this setupScetch. Type can be primitive, enum , or MyStruct[] . Each of these types needs its own cell type.

It came to bloody mazol on the fingers, for we started in runtime to generate types under the grid, but this decision doesn’t let me fall asleep for a week with its magnificence. Help overcome insomnia ...

  • chloroform? - Gorets

3 answers 3

Use for the cell the template in which ContentControl lies, for it define a TemplateSelector , which will define the templates for specific content.

    I repeatedly did such things.

    System.ComponentModel.TypeDescriptor.GetProperties(тип или объект) is the main method for this. Get property descriptions and dynamically generate controls for them.

    If the object's property set depends on the data, implement ICustomTypeDescriptor in it. In this interface, you can override the method of obtaining a description of properties.

      In my opinion, a person wants to create a set for different types of cells. It is commendable, I was also looking for norms on the Internet. PropertyGrid. If you stop on it, then here is a good and free open source control, it already has its own system for adding new types, everything seems to be not difficult, there are good examples of WPF PROPERTY GRID