Many data types in single column

Apr 8, 2009 at 7:43 PM

I want to create something similar to Properties Editor (like e.g. in Visial studio), where in second column (titled 'values') I can host many types (like text editor, drop down, color picker, etc)

Is is possible to handle it, with both "normal " and edit cell template.

I have created something like:

        <DataTemplate DataType="{x:Type Properties:DropDownProperty}">
            <ComboBox Grid.Column="1" ItemsSource="{Binding Path=Items}" DisplayMemberPath="Title"
                    SelectedValue="{Binding Path=SelectedItem}" />
        <DataTemplate DataType="{x:Type Properties:TextProperty}">

<Toolkit:DataGrid  AutoGenerateColumns="False" ItemsSource="{Binding Path=SelectedControl.Properties}">
            <Toolkit:DataGridTextColumn Binding="{Binding Name, Mode=OneWay}" Header="Name" IsReadOnly="True" />
            <Toolkit:DataGridTemplateColumn Header="Value">
                        <ContentControl Content="{Binding}" />

But with this approach, I cannot switch EditCellTemplate<->CellTemplate, since DataTemplate for cutom type is defined globally.

Is there any way to solve this problem?