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

Is there a way to enable formatting on columns that have templates

2 Answers 43 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Casey
Top achievements
Rank 1
Casey asked on 20 Apr 2011, 09:04 PM
I have a bit column that I am binding to. I want to show True or False instead of default Checkbox. 
Is there a way to turn that on?

However when I show True/False i lose the Sort/Filtering options.


Shows True False.. but not Sort/Filter
<grid:GridViewColumn Header="Is Public" UniqueName="IsPublic">
          <grid:GridViewColumn.CellTemplate>
                   <DataTemplate>
                        <TextBlock Text="{Binding IsPublic}"></TextBlock>
                    </DataTemplate>
            </grid:GridViewColumn.CellTemplate>
 </grid:GridViewColumn>
      '

Shows Checkbox.. does show Sort/Filter          
 <grid:GridViewDataColumn Header="Is Public2" DataMemberBinding="{Binding IsPublic}"    >
  </grid:GridViewDataColumn>

2 Answers, 1 is accepted

Sort by
0
Casey
Top achievements
Rank 1
answered on 20 Apr 2011, 09:30 PM
FYI.. adding IsFilterable does not help


<grid:GridViewColumn Header="Is Public" IsFilterable="True" IsGroupable="True" IsSortable="True" UniqueName="IsPublic">
                  <grid:GridViewColumn.CellTemplate>
                      <DataTemplate>
                          <TextBlock Text="{Binding IsPublic}"></TextBlock>
                      </DataTemplate>
                  </grid:GridViewColumn.CellTemplate>
              </grid:GridViewColumn>

 
                </grid:GridViewColumn>
                
0
Yavor Georgiev
Telerik team
answered on 20 Apr 2011, 10:01 PM
Hello Casey,

 GridViewColumn is not a data-bound column, so it cannot be filtered. You can take the GridViewDataColumn you have shown in your initial post and just define the same CellTemplate you have for the GridViewColumn. Keep in mind that you need to preserve the DataMemberBinding attribute on the GridViewDataColumn, regardless of the fact that you define the same binding in the CellTemplate. The DataMemberBinding is also used for filtering, sorting, etc.

Kind regards,
Yavor Georgiev
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
Casey
Top achievements
Rank 1
Answers by
Casey
Top achievements
Rank 1
Yavor Georgiev
Telerik team
Share this question
or