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

EditorStyle for GridViewDataColumn

0 Answers 150 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ROBERTO
Top achievements
Rank 1
ROBERTO asked on 03 Feb 2012, 06:48 PM
I have a RadGridView with a GridRowStyle that sets the row background to transparent. This is so that the RadGridView background shows through. I setup a CellEditTemplateSelector for a column to allow only certain types of values to be editable. I noticed that the background of the cell turns white when it goes into edit mode regardless of the datatemplate used. I tried setting the EditorStyle in the column with a style that targeted the GridViewEditorPresenter to set its background to transparent but at runtime an unhandled exception is raised. I also setup another column without the CellEditTemplateSelector with a plain textblock data template for both CellEditTemplate and CellTemplate and the same error is raised when you click on the cell.

<Style x:Key="CellEditorStyle"
               TargetType="telerik:GridViewEditorPresenter">
            <Setter Property="Background"
                    Value="Transparent" />
 </Style>
 
<telerik:RadGridView ItemsSource="{Binding MetadataAttributes}"
                AutoGenerateColumns="False"
                RowStyle="{StaticResource GridViewRowStyle}"
                Background="LightBlue">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Attribute"
                            DataMemberBinding="{Binding Name}"
                            IsReadOnly="True" />
 
<telerik:GridViewDataColumn Header="Selector Test"
                            IsReadOnly="False"
                            MinWidth="100"
                            CellEditTemplateSelector="{StaticResource EditCellDataTemplateSelector}"
                            EditorStyle="{StaticResource CellEditorStyle}"
                            DataMemberBinding="{Binding}"
                            EditTriggers="CellClick">
    <telerik:GridViewDataColumn.CellTemplate>
        <DataTemplate>
            <Grid Background="Transparent">
                <TextBlock Text="{Binding Value}" />
            </Grid>
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
 
<telerik:GridViewDataColumn Header="Value"
                            IsReadOnly="False"
                            MinWidth="100"
                            DataMemberBinding="{Binding}"
                            EditorStyle="{StaticResource CellEditorStyle}"
                            EditTriggers="CellClick">
    <telerik:GridViewDataColumn.CellEditTemplate>
        <DataTemplate>
            <Grid>
                <TextBlock Text="{Binding Value}" />
            </Grid>
        </DataTemplate>
    </telerik:GridViewDataColumn.CellEditTemplate>
    <telerik:GridViewDataColumn.CellTemplate>
        <DataTemplate>
            <Grid>
                <TextBlock Text="{Binding Value}" />
            </Grid>
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
 
</telerik:RadGridView.Columns>
</telerik:RadGridView>


Is there a way to accomplish what I am trying to do?

Using Silvelight 4 with Telerik Controls 2011.2.0712.1040

No answers yet. Maybe you can help?

Tags
GridView
Asked by
ROBERTO
Top achievements
Rank 1
Share this question
or