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

[Solved] Sort and Filter functionality when using Converter in DataMemberBinding on GridViewDataColumn

2 Answers 322 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Luzius
Top achievements
Rank 1
Luzius asked on 19 Jan 2011, 04:44 PM
Hi

I use converters in data member bindings. But thus I lose the automatic filter and sort functionality. Is it possible to have this functionality even when using converters?

<telerik:RadTreeListView Grid.Column="1" Name="tlvLicMgmt" AutoGenerateColumns="False" IsFilteringAllowed="True" >
<telerik:RadTreeListView.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition ItemsSource="{Binding SubNodes}" />
</telerik:RadTreeListView.ChildTableDefinitions>
<telerik:RadTreeListView.Columns>
<telerik:GridViewDataColumn x:Name="NodeTextAndIcon" Header="Name" CellTemplate="{StaticResource NodeTextAndIcon}" IsReadOnly="True" />
<telerik:GridViewDataColumn x:Name="colLicType" Header="Eval. Type" DataMemberBinding="{Binding Converter={StaticResource licTypeConverter}, ConverterParameter='AsText'}" IsReadOnly="True" />
</telerik:RadTreeListView.Columns>
</telerik:RadTreeListView>

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 24 Jan 2011, 02:25 PM
Hi Luzius,

Depending on your particular requirements, you may try to define the CellTemplate and CellEditTemplate of the column using an IValueConverter. I am sending you a sample project illustrating the proposed solution.
  

All the best,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Luzius
Top achievements
Rank 1
answered on 25 Jan 2011, 09:17 AM
Hi,

Thanks for your response. Changing my DataMemberBinding definition
from:
<telerik:GridViewDataColumn x:Name="colLicType" Header="Eval. Type"
 DataMemberBinding="{Binding Converter={StaticResource licTypeConverter}}" IsReadOnly="True" /> 
to:
DataMemberBinding="{Binding LicType, Converter={StaticResource licTypeConverter}}"
caused the filter symbol to show up. In addition I had to add the CellTemplate definition below to get the values displayed.
<telerik:GridViewDataColumn.CellTemplate>
    <DataTemplate>
        <TextBlock Text="{Binding Converter={StaticResource LicTypeConverter}}" />
    </DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>

Now the controls for filtering are there, but if I open the filter dialog only the value of the first line is displayed as selectable choice of distinct filters. I found the answer to this in the documentation (http://www.telerik.com/help/silverlight/radtreelistview-features-filtering.html). Which says: Only the values at the highest level of the hierarchy are included in the distinct filter list.

Thanks,
Luzius
Tags
TreeListView
Asked by
Luzius
Top achievements
Rank 1
Answers by
Maya
Telerik team
Luzius
Top achievements
Rank 1
Share this question
or