Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1450
Databound EditorStyle and EditorType
posted

Hi there

I'm a bit stuck, finding a solution to our following use case. We have a list of items in a XamDataGrid and an item has a property, which determines what kind of editor should be used to input a value for a second property.

So if item.TypeData is "string", then the editor for Item.Value should be a XamTextEditor, if item.TypeData is "num", then the editor should be a XamNumericEditor, item.TypeData is "list" then the editor should be a XamComboEditor with a matching style (for stuff like ItemSource, DisplayMemberPath, ValuePath), and so on.

We fill a property called 'EditorStyle' depending on the property "TypeData" with the correct style in our object and try to bind it with a CellBinding. But this is only working, when the EditorType is set on the Field. (So for the whole column, not only the cell.) But if we try to use a XamTextEditor, when the Field.EditorType is set to another type than XamTextEditor, this obviously is not working.

                    <igDP:Field Name="CodeValue" >
                        <!--<igDP:Field.Settings>
                            <igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}" />
                        </igDP:Field.Settings>-->
                        <igDP:Field.CellBindings>
                            <igDP:CellBinding Property="IsReadOnly" Target="Editor" Binding="{Binding Path=DataItem.DisallowCodeValue}" />
                            <!--<igDP:CellBinding Property="ValueType" Target="CellValuePresenter" Binding="{Binding Path=DataItem.ValueType}" />-->
                            <igDP:CellBinding Property="Style" Target="Editor" Binding="{Binding Path=DataItem.EditorStyle}" />
                        </igDP:Field.CellBindings>
                    </igDP:Field>

Any idea how to achieve this?

Parents Reply Children