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

CellTemplate in ResourceDictionary

1 Answer 75 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Thomas asked on 20 Mar 2016, 08:31 PM

I tried to move my Grid Columns Content to a separate ResourceDictionary and it works for the first part  the "GridViewDataColumn" not perfectly i expect


a) not for the GridViewCheckBoxColumn , do you have a suggestion how to do this ?

b) and 2nd i used the common "TextBox" for the GridViewDataColumn (child control) but which Control should i use if i want the Telerik Standard Control  which is normaly used in the GridView ? if i add

    <t:GridViewDataColumn Header="VALID" ...

    it want work , vs designer tell me that it could not found it


thanks br


<telerik:GridViewDataColumn Header="XNAME" CellEditTemplate="{StaticResource ClaimListNameDataTemplate}" CellTemplate="{StaticResource ClaimListNameDataTemplate}"/>

<telerik:GridViewCheckBoxColumn Header="VALID" DataMemberBinding="{Binding IsValidYn, Mode=TwoWay}"  AutoSelectOnEdit="True" EditTriggers="CellClick" Width="75*"
                                                CellTemplate="{StaticResource ClaimListValidDataTemplate}" CellEditTemplate="{StaticResource ClaimListValidDataTemplate}"
                    <telerik:GridViewCheckBoxColumn.CellStyle >
                        <Style TargetType="telerik:GridViewCell" BasedOn="{StaticResource CenterCheckBoxColumnCellStyle}">
                            <Setter Property="HorizontalContentAlignment" Value="Center" />




<ResourceDictionary x:Class="Application.Views.ClaimListResourceDictionary"
    <DataTemplate x:Key="ClaimListNameDataTemplate" DataType="{x:Type local:ClaimList}">
        <StackPanel Orientation="Vertical" Background="Brown">
            <Image Height="50" Width="50" HorizontalAlignment="Center" Source="/GapJunctionApplication;component/Images/Refresh2.png"/>
            <TextBox HorizontalAlignment="Stretch" BorderThickness="0" SelectionBrush="Green" BorderBrush="Black" Text="{Binding name_nam, Mode=TwoWay}" TextAlignment="Right"/>

    <DataTemplate x:Key="ClaimListValidDataTemplate" DataType="{x:Type local:ClaimList}">






1 Answer, 1 is accepted

Sort by
Telerik team
answered on 22 Mar 2016, 10:40 AM
Hi Thomas ,

Generally, by default the GridViewCheckBoxColumn uses a GridViewCheckBox control for the cell in view mode, and a standard MS CheckBox in edit mode. If you need to predefine the template of a particular column, but keep the default one for the rest of the columns, you can benefit from the CellTemplateSelector mechanism. By doing so, you won't need to predefine the templates of all columns.

As to the error you are getting from the designer, I might only be guessing what the cause for it might be. I suggest you taking a look at this, this and this StackOverflow threads for a possible solution. You may also find the Debugging and Interpreting Errors in the WPF Designer.

All the best,
Stefan X1
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question