2

Simple question....

I have an issue binding a column in RadGrid (SILVERLIGHT) to a custom type.

My scenario:

<telerik:RadGridView x:Name="Grid1" AutoGenerateColumns="false" ItemsSource="{Binding Items}" IsReadOnly="true"  >
 <telerik:RadGridView.Columns>
 <telerik:GridViewDataColumn DataMemberBinding="{Binding ID, Mode=OneTime}"  />
 <telerik:GridViewDataColumn DataMemberBinding="{Binding Vehicle, Mode=OneTime}"  >
     <telerik:GridViewColumn.CellEditTemplate>
                    <DataTemplate>
                        <TextBlock Text="Name"></TextBlock>
                    </DataTemplate>
                </telerik:GridViewColumn.CellEditTemplate>
            </telerik:GridViewDataColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

where Items is an ObservableCollection of:

public class Source
{
    public int ID {get; set;}
    public Vehicle Vehicle {get; set;}
}

public class Vehicle
{
    public int ID{get; set;}
    public string Name {get; set;}
}

So ID column is displayed correctly, but Vehicle column is empty...where am I going wrong?

Thanks

EDIT

      <telerik:GridViewDataColumn DataMemberBinding="{Binding Vehicle, Mode=OneTime}"  >
                <telerik:GridViewColumn.CellTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Name}"></TextBlock>
                    </DataTemplate>
                </telerik:GridViewColumn.CellTemplate>
            </telerik:GridViewDataColumn>

using CellTemplate and Not CellEditTemplate i have still the same problem

user756037
  • 285
  • 1
  • 8
  • 20

1 Answers1

1

Assuming your code is cut & pasted: You have misspelt Vehicle as Vehilce in your Source class.

If you check your debug output window it should report any binding errors with enough detail to find this sort of mistake.

iCollect.it Ltd
  • 92,391
  • 25
  • 181
  • 202