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

[Solved] DataTemplates and cell styling

1 Answer 127 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jon Bergquist
Top achievements
Rank 1
Jon Bergquist asked on 27 Mar 2009, 12:53 AM
This is just a general question about when to use the datatemplate when styling a cell.  I've seen examples where you style using:

<Style x:Key="cellStyle" TargetType="telerikGrid:GridViewCell" > 
                <Setter Property="Template"
                    <Setter.Value> 
                        <ControlTemplate TargetType="telerikGrid:GridViewCell"
                            <StackPanel Orientation="Vertical"
                                <TextBlock Text="{Binding name}"/> 
                                <TextBlock Text="{Binding address}"/> 
                            </StackPanel> 
                        </ControlTemplate> 
                    </Setter.Value> 
                </Setter> 
 
and other examples of where you include the datatemplate:

<Style x:Key="cellStyle2" TargetType="telerikGrid:GridViewCell" > 
                <Setter Property="ContentTemplate"
                    <Setter.Value> 
                        <DataTemplate> 
 
                            <StackPanel Orientation="Vertical"
                                <TextBlock Text="{Binding name}"/> 
                                <TextBlock Text="{Binding address}"/> 
                            </StackPanel> 
                        </DataTemplate> 
                    </Setter.Value> 
                </Setter> 
            </Style> 
What is the rule of thumb in these situations? 





1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 27 Mar 2009, 06:36 AM
Hi Jon,

Please check this thread for more info:
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/d8f79b2b-c745-42bd-a821-db9ce0b5c2e9/

Kind regards,
Vlad
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Jon Bergquist
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or