Sort and Filter functionality when using Converter in DataMemberBinding on GridViewDataColumn

3 posts, 1 answers
  1. Luzius
    Luzius avatar
    14 posts
    Member since:
    Jun 2010

    Posted 19 Jan 2011 Link to this post


    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:TreeListViewTableDefinition ItemsSource="{Binding SubNodes}" />
    <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" />

  2. Answer
    Maya avatar
    4062 posts

    Posted 24 Jan 2011 Link to this post

    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,
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. Luzius
    Luzius avatar
    14 posts
    Member since:
    Jun 2010

    Posted 25 Jan 2011 Link to this post


    Thanks for your response. Changing my DataMemberBinding definition
    <telerik:GridViewDataColumn x:Name="colLicType" Header="Eval. Type"
     DataMemberBinding="{Binding Converter={StaticResource licTypeConverter}}" IsReadOnly="True" /> 
    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.
            <TextBlock Text="{Binding Converter={StaticResource LicTypeConverter}}" />

    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 ( Which says: Only the values at the highest level of the hierarchy are included in the distinct filter list.

Back to Top