Issue Refreshing Column Filters

3 posts, 0 answers
  1. Matthew
    Matthew avatar
    2 posts
    Member since:
    Feb 2012

    Posted 01 Feb 2012 Link to this post

    Hello,

    I have a RadGridView with an ObservableCollection as it's ItemsSource.

    The ObservableCollection holds a collection of objects similar in relation to sports players and teams.

    where the Player object looks like:
    ObservableCollection<Player> _players;
     
    // Psuedo-code Object Descriptions
    Player
    {
        UniqueIdentifier (Guid)
        string Name
        Guid TeamID (FK to Team's UniqueIdentifier)
        string Position
        int Number
        //etc.
    }
      
    Team
    {
        UniqueIdentifier (Guid)
        string Name
        string Location
        //etc.
    }

    <telerik:RadGridView>
        <telerik:RadGridView.Columns>
            <telerik:GridViewDataColumn Header="Team"
                                DataMemberBinding="{Binding Team.Name}" />
            <telerik:GridViewDataColumn Header="Name"
                                DataMemberBinding="{Binding Name}" />
            <telerik:GridViewDataColumn Header="Position"
                                DataMemberBinding="{Binding Position}" />
            <telerik:GridViewDataColumn Header="Number"
                                DataMemberBinding="{Binding Number}" />
        </telerik:RadGridView.Columns>
    </telerik:RadGridView>

    The RadGrid I have is displaying columns for all of the properties similar to the XAML posted above.

    I query for all the Players, Including the Navigation Property for Team, asynchronously.  In the callback I call _players.Clear() and Add the results from the query to _players.

    After the first query the column filters on the RadGridView work fine.  When I perform the Load operation again, and then click on the Filter icon on the Column with Header == "Team" the screen goes blank and I get this message in my output window:
    "Binding cannot be changed after it has been used."

    I've also seen this error when the site is deployed:

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; BRI/2; MS-RTC LM 8)

    Timestamp: Mon, 30 Jan 2012 20:08:56 UTC



    Message: Unhandled Error in Silverlight Application [Binding_CannotBeChangedAfterUse]

    Arguments:

    Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.60831.0&File=System.Windows.dll&Key=Binding_CannotBeChangedAfterUse  
       at System.Windows.Data.BindingBase.CheckSealed()

       at Telerik.Windows.Data.DataFieldDescriptorExtensions.PrepareBinding(IDataFieldDescriptor fieldDescriptor, Binding memberBinding)

       at Telerik.Windows.Data.DataFieldDescriptorExtensions.CreateConvertedAndFormattedValueFunc(IDataFieldDescriptor fieldDescriptor, Func`2 func)

       at Telerik.Windows.Controls.GridView.FilteringViewModel.InitializeConvertedAndFormattedValueFunc()

       at Telerik.Windows.Controls.GridView.FilteringViewModel.CreateDistinctValueViewModel(Object distinctValue)

       at Telerik.Windows.Controls.GridView.DistinctValueViewModelCollection.AddRangeFromSource(IEnumerable source)

       at Telerik.Windows.Controls.GridView.DistinctValueViewModelCollection.SetSource(IEnumerable source, Func`2 createDistinctValueCallback)


    I managed to work around this problem by creating a property (and binding to it instead) on my Player BO similar to:

    public string TeamName
    {
        get { return this.Team == null ? string.Empty : this.Team.Name; }
    }
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 02 Feb 2012 Link to this post

    Hi,

    What version of our controls are you using?

    Can you send us a dummy sample project that reproduces this exception and we will debug it immediately.

    Thanks in advance.

    Regards,
    Ross
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Matthew
    Matthew avatar
    2 posts
    Member since:
    Feb 2012

    Posted 02 Feb 2012 Link to this post

    I'm using Version: 2011.3.1116.1040

    I have been unable to reproduce this issue outside my project. It's possible that there is something I am doing while populating the ObservableCollection is causing this problem, but my theory is that it has something to do with how the NavigationProperty is populating.

    Sorry I cannot be of more help. I have a workaround I'm willing to live with and don't have a lot of time to spend trying to figure out what's actually going on.
Back to Top