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

    Hello,

    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">
                    <telerik:RadGridView.RowStyle>
                        <Style TargetType="telerik:GridViewRow">
                            <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=OneWayToSource}"/>
                        </Style>
                    </telerik:RadGridView.RowStyle>
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewSelectColumn/>
                        <telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name}"/>
                    </telerik:RadGridView.Columns>
                </telerik:RadGridView>

  2. Yoan
    Admin
    Yoan avatar
    1070 posts

    Posted 09 Nov 2015 Link to this post

    Hello,

    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.

    Regards,
    Yoan
    Telerik
    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. UI for WPF is Visual Studio 2017 Ready
  4. 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