If there has GridViewSelectColumn, The data context can not be accessed by other thread

3 posts, 0 answers
  1. Chen
    Chen avatar
    2 posts
    Member since:
    Jun 2015

    Posted 04 Nov 2015 Link to this post


    I have a gridview below. The code "await Task.Run(() => { View.clear(); });" throw an exception:"The calling thread cannot access this object because a different thread owns it." But if I remove "<telerik:GridViewSelectColumn/>", it​ works, please tell me how to fix it? Thanks.

    <telerik:RadGridView Name="view" ShowGroupPanel="False" Margin="10" IsReadOnly="True" ItemsSource="{Binding View}" AutoGenerateColumns="False" SelectionMode="Extended">
                        <Style TargetType="telerik:GridViewRow">
                            <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=OneWayToSource}"/>
                        <telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name}"/>

  2. Yoan
    Yoan avatar
    1128 posts

    Posted 09 Nov 2015 Link to this post


    I guess that the problem is related with the use of GridViewSelect column and the binding of the IsSelected property of the GridViewRow. However, can you try to execute your code using a dispatcher? Please give it a try and let me know how it works for you.

    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 Feedback Portal and vote to affect the priority of the items
  3. Chen
    Chen avatar
    2 posts
    Member since:
    Jun 2015

    Posted 17 Nov 2015 in reply to Yoan Link to this post

    Yes, using a dispatcher is good to me. Thank you for your feedback.
Back to Top