I'm trying to show rowdetails when rowSelected. 'mean' is one of column in DataTable, but I got binding error. Can someone tell me what went wrong. Thanks.
System.Windows.Data Error: 40 : BindingExpression path error: 'mean' property not found on 'object' ''DataRow' (HashCode=22373539)'. BindingExpression:Path=mean; DataItem='DataRow' (HashCode=22373539); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
<
telerikGrid:RadGridView x:Name="radGridView" Grid.Row="0" ItemsSource="{Binding DataTable}" AutoGenerateColumns="True"
ShowGroupPanel="False" RowDetailsVisibilityMode="VisibleWhenSelected" IsReadOnly="True"
AutoGeneratingColumn="radGridView_AutoGeneratingColumn"
RowIndicatorVisibility="Collapsed" IsSynchronizedWithCurrentItem="False">
<telerikGrid:RadGridView.RowDetailsTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal"
Margin="10,10,10,10">
<TextBlock Text="Average Measure Value: " />
<TextBlock Text="{Binding mean}" />
</StackPanel>
</DataTemplate>
</telerikGrid:RadGridView.RowDetailsTemplate>
</telerikGrid:RadGridView>
10 Answers, 1 is accepted
Please use square brackets for the Binding with DataTable, DataView, etc.
All the best,Vlad
the Telerik team

Thanks, I got it.

Try binding it behind the code, sample square bracket binding. Hope it helps!
[Browsable(false)]
public BindingContext BindingContext
{
get
{
if (bindingContext == null)
{
bindingContext = new BindingContext();
}
return bindingContext;
}
set
{
bindingContext = value;
}
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public ControlBindingsCollection DataBindings
{
get
{
if (dataBindings == null)
{
dataBindings = new ControlBindingsCollection(this);
}
return dataBindings;
}
}
You can find more info here:
http://msdn.microsoft.com/en-us/library/cc189022(VS.95).aspx
http://msdn.microsoft.com/en-us/library/cc645024(v=VS.95).aspx
Vlad
the Telerik team

Is there a better way to handle this issue in the current version? I am trying to edit cells (DataTable is underlying binding) but I am getting the same error as described earlier in this thread. I create my columns in code and instantiate a Binding object such as Binding b = new Binding("columnName");
If I update my code to Binding b = new Binding("[columnName]"), the exception goes away. However, other parts of the grid fail such as grouping since my column names in the DataTable do actually do not have brackets (and they should not).
Perhaps I am not applying the suggestion of this thread correctly.
Could you please help?
Thanks,
Julien
You will not have problems with grouping with such binding. I've attached an example project for reference.
Greetings,Vlad
the Telerik team

You you will get correct behavior no matter if the column is created programmatically or declared in XAML. You can check the attachment for reference.
Regards,Vlad
the Telerik team

Please let me know.
Julien
In this case you may need to create your RowDetailsTemplate programmatically. Recently Pete Brown posted very good blog post related to this. You can check it here.
Best wishes,Vlad
the Telerik team