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

Cell binding template

1 Answer 79 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 27 Oct 2009, 08:06 PM
So, we are using an older version of the Grid control.  Kinda stuck with it for now because we are at the very end of product development and we can't afford to be changing anything at this point.

I have had an annoying problem for awhile that has been a lower bug issue, but now I'm finally getting to it.

I'm assuming the developers used this method of binding data to the cell because this was the only way to use a converter. But this is messing up the default cell style. the cell doesn't look like the other cells. It's kinda a pain to go into every instance of the grid we are using in the application and fix the style where they have overridden the template.

Question: Is this the best way to do this? Is there a better way to do this binding without overriding the template?  Again, we can't update the control. We are stuck with 2009.1.312.35 for now. 


<
telerik:GridViewDataColumn UniqueName="UserNames" 
                                                    HeaderText="{x:Static properties:Resources.Population_GridHeader_UserName}"
                            <telerik:GridViewColumn.CellStyle> 
                                <Style TargetType="{x:Type telerik:GridViewCell}"
                                    <Setter Property="Template"
                                        <Setter.Value> 
                                            <ControlTemplate TargetType="{x:Type telerik:GridViewCell}"
                                                <Border BorderThickness="{TemplateBinding BorderThickness}" 
                                                        BorderBrush="{TemplateBinding BorderBrush}" 
                                                        Background="{TemplateBinding Background}"
                                                    <TextBlock Text="{Binding Path=UserNames, Mode=OneWay, Converter={StaticResource UserNameListToStringConverter}}" 
                                                               VerticalAlignment="Center" 
                                                               Margin="5" /> 
                                                </Border> 
                                            </ControlTemplate> 
                                        </Setter.Value> 
                                    </Setter> 
                                </Style> 
                            </telerik:GridViewColumn.CellStyle> 
                        </telerik:GridViewDataColumn> 

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 28 Oct 2009, 06:05 AM
Hello Charles,

Unfortunately with this version there is no other way - you can try to update at least to Q1 2009 SP1 - I believe that both DataMemberBinding property and CellTemplate/CellEditTemplate were introduced with this service pack.

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Charles
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or