This is a migrated thread and some comments may be shown as answers.

Custom column inheriting from GridViewBoundColumnBase

1 Answer 187 Views
GridView
This is a migrated thread and some comments may be shown as answers.
CB
Top achievements
Rank 1
CB asked on 09 Jun 2011, 06:30 PM
Hi,

I'm trying to create a custom column that inherits from GridViewBoundColumnBase but I want to style it entirely in XAML.

I need to know how to do the binding between the column's DataMemberBinding and the editor.

Here is a simple example (the GridViewColumnTextBox is empty and inherit's GridViewBoundColumnBase):

        <Style TargetType="{x:Type Controles:GridViewColumnTextBox}">
            <Setter Property="CellEditTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <TextBox Text="BINDING?"/>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>

So, is there any way to do the binding to DataMemberBinding ?

1 Answer, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 15 Jun 2011, 09:40 AM
Hello Jean-François,

As there is no direct way to do this in xaml I may suggest the following workaround :

1. Define your template in XAML , and mark the element to be used as editor with a known name e.g. "PART_MyTextBox" ,

2. In the overriden code of the column you may load the template , find the element by its name and set the binding via code ( element.SetBinding(TextBox.TextProperty, this.DataMemberBinding).

Let me know if you need additional help.

All the best,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
CB
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Share this question
or