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

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

2 Answers 144 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chen
Top achievements
Rank 1
Chen asked on 04 Nov 2015, 10:05 AM

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 Answers, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 09 Nov 2015, 08:43 AM
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
0
Chen
Top achievements
Rank 1
answered on 18 Nov 2015, 12:49 AM
Yes, using a dispatcher is good to me. Thank you for your feedback.
Tags
GridView
Asked by
Chen
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Chen
Top achievements
Rank 1
Share this question
or