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

Filter refresh grid lines when PropertyChanged

3 Answers 137 Views
GridView
This is a migrated thread and some comments may be shown as answers.
JC
Top achievements
Rank 1
JC asked on 11 Mar 2011, 10:14 AM
Hello Telerik  ! :)

Today I have a problem with a column filter binded on a boolean value.

My data object (RIA partial client side) : 

public partial class Element
{
    ...
    public bool IsConnected
    {
      get { return this.CurrentParametresReleves.Any(hp => hp.Action > 0); }
    }
    public void RaiseIsConnectedChanged()
      {
          this.RaisePropertyChanged("IsConnected");
      }
    ...
}

The gridView  :
<tlk:RadGridView x:Name="_ListElements" >
  <tlk:RadGridView.Columns>
    ...
    <tlk:GridViewCheckBoxColumn Header=" " DataMemberBinding="{Binding Element.IsConnected, Mode=OneWay}"
                                IsReadOnly="True" IsResizable="False" UniqueName="IsConnectedColumn" />
    ...
  </tlk:RadGridView.Columns>
</tlk:RadGridView>

The filter of the grid view :
GridViewColumn isConnectedColumn = _ListElements.Columns["IsConnectedColumn"];
var isConnectedFilter = new ColumnFilterDescriptor((IDataFieldDescriptor)isConnectedColumn);
isConnectedFilter.DistinctFilter.DistinctValues.Add(true);
_ListElements.FilterDescriptors.Add(isConnectedFilter);

So, the filter work when I set the ItemsSource on the grid.
When I notify the change of "IsConnected" to "False" in my code behind the checkBox in the grid changed (checked to unchecked).
But now I would like that the line disappears because the filter must show only "True" elements !

How to do this please ?
Thanks
JC

3 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 11 Mar 2011, 11:23 AM
Hi JC,

You will have to tell the grid to refresh, since it will not do it automatically (this is by design for performance purposes).

Can you try to call RadGridView.Rebind() and see what happens.  

Kind regards,
Ross
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
JC
Top achievements
Rank 1
answered on 11 Mar 2011, 12:00 PM
Tanks for your reply !
Bad news for me ... 
So I tried "Rebind" and it's work but my model must pilot my view, it's not the "design" of Silverlight ...

However, I have another question, how to change text "True" and "False" in the filter ? (look at my attach file)

Bye
JC
0
Rossen Hristov
Telerik team
answered on 14 Mar 2011, 10:19 AM
Hello JC,

You can either use an IValueConverter for the column binding which will be respected by the filtering control, or you can develop your own custom filtering control.

All the best,
Ross
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
GridView
Asked by
JC
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
JC
Top achievements
Rank 1
Share this question
or