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

GridViewColumn - Binding to specific usercontrol

1 Answer 209 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Fabrice
Top achievements
Rank 1
Fabrice asked on 22 Jan 2014, 08:53 AM
Hi,

I have a little problem

My gridview bind to a Observable collection and work well.
I would add a column wich contains a specific usercontrol and the binding is a List<MyViewModel> but it doesn't.
The datacontext of my control is ever null.

the XAML :
<telerik:RadGridView Name="RadGridView" Grid.Row="1" ItemsSource="{Binding Path=Documents}" DataLoadMode="Asynchronous" AutoGenerateColumns="False" SelectionMode="Single" CanUserDeleteRows="False" CanUserInsertRows="False">
<telerik:RadGridView.Columns>
...
<telerik:GridViewDataColumn IsReadOnly="True" Header="Fichier(s) joint(s)" DataMemberBinding="{Binding Files}" >
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<control:UserControl1 DataContext="{Binding Files}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
...
</telerik:RadGridView>

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 23 Jan 2014, 09:07 AM
Hello,

Is the Files collection a property of the bound business object (Document)? If not, then you should specify a valid Source for the Binding through a StaticResource.

Also,I must point that you should remove DataLoadMode="Asyncronous" for RadGridView. This mode is very old and it makes no sense at all using it any more.

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Fabrice
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or