Hello Telerik,
This is probably a silly question with an obvious answer - but I am having issues with my CellTemplate content binding...
<telerik:RadGridView x:Name="GridViewDetailAC" AutoGenerateColumns="False" AlternateRowBackground="White" AlternationCount="2" AllowDrop="True" CanUserSelect="True" CanUserDeleteRows="False" CanUserInsertRows="False" CanUserResizeColumns="True" EditTriggers="None" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4" HorizontalGridLinesBrush="SlateGray" ItemsSource="{Binding XXXX}" RowIndicatorVisibility="Collapsed" RowHeight="26" SelectedItem="{Binding Path=SelectedXXXX, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" SelectionMode="Single" SelectionUnit="FullRow" ShowColumnFooters="False" ShowGroupPanel="False" ShowColumnHeaders="True" VerticalGridLinesBrush="Transparent"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn Header="Vendor" Width="Auto" TextAlignment="Left" IsVisible="{Binding ElementName=ckbVendorVisi, Path=IsChecked, FallbackValue=0}"> <telerik:GridViewDataColumn.CellTemplate> <DataTemplate> <DockPanel> <Label Content="{Binding Path=LV_Name, FallbackValue=''}" Visibility="{Binding Path=NotNewRecord, FallbackValue=0, Converter={StaticResource BoolVisiRevConv2}}"/> <TextBox Text="{Binding Path=LV_Name, FallbackValue=''}" Visibility="{Binding Path=NotNewRecord, FallbackValue=0, Converter={StaticResource BoolVisiConv2}}"/> </DockPanel> </DataTemplate> </telerik:GridViewDataColumn.CellTemplate></telerik:GridViewDataColumn>The above piece of code, using MVVM, produces a 'System.Windows.Data Information XX' errors - Three to be exact: 41, 20, 21 for each ViewModel property binding.
System.Windows.Data Information: 41 : BindingExpression path error: 'LV_Name' property not found for 'object' because data item is null. This could happen because the data provider has not produced any data yet. BindingExpression:Path=LV_Name; DataItem=null; target element is 'Label' (Name=''); target property is 'Content' (type 'Object')System.Windows.Data Information: 20 : BindingExpression cannot retrieve value due to missing information. BindingExpression:Path=LV_Name; DataItem=null; target element is 'Label' (Name=''); target property is 'Content' (type 'Object')System.Windows.Data Information: 21 : BindingExpression cannot retrieve value from null data item. This could happen when binding is detached or when binding to a Nullable type that has no value. BindingExpression:Path=LV_Name; DataItem=null; target element is 'Label' (Name=''); target property is 'Content' (type 'Object')System.Windows.Data Information: 41 : BindingExpression path error: 'NotNewRecord' property not found for 'object' because data item is null. This could happen because the data provider has not produced any data yet. BindingExpression:Path=NotNewRecord; DataItem=null; target element is 'Label' (Name=''); target property is 'Visibility' (type 'Visibility')System.Windows.Data Information: 20 : BindingExpression cannot retrieve value due to missing information. BindingExpression:Path=NotNewRecord; DataItem=null; target element is 'Label' (Name=''); target property is 'Visibility' (type 'Visibility')System.Windows.Data Information: 21 : BindingExpression cannot retrieve value from null data item. This could happen when binding is detached or when binding to a Nullable type that has no value. BindingExpression:Path=NotNewRecord; DataItem=null; target element is 'Label' (Name=''); target property is 'Visibility' (type 'Visibility')System.Windows.Data Information: 41 : BindingExpression path error: 'LV_Name' property not found for 'object' because data item is null. This could happen because the data provider has not produced any data yet. BindingExpression:Path=LV_Name; DataItem=null; target element is 'TextBox' (Name=''); target property is 'Text' (type 'String')System.Windows.Data Information: 20 : BindingExpression cannot retrieve value due to missing information. BindingExpression:Path=LV_Name; DataItem=null; target element is 'TextBox' (Name=''); target property is 'Text' (type 'String')System.Windows.Data Information: 21 : BindingExpression cannot retrieve value from null data item. This could happen when binding is detached or when binding to a Nullable type that has no value. BindingExpression:Path=LV_Name; DataItem=null; target element is 'TextBox' (Name=''); target property is 'Text' (type 'String')System.Windows.Data Information: 41 : BindingExpression path error: 'NotNewRecord' property not found for 'object' because data item is null. This could happen because the data provider has not produced any data yet. BindingExpression:Path=NotNewRecord; DataItem=null; target element is 'TextBox' (Name=''); target property is 'Visibility' (type 'Visibility')System.Windows.Data Information: 20 : BindingExpression cannot retrieve value due to missing information. BindingExpression:Path=NotNewRecord; DataItem=null; target element is 'TextBox' (Name=''); target property is 'Visibility' (type 'Visibility')System.Windows.Data Information: 21 : BindingExpression cannot retrieve value from null data item. This could happen when binding is detached or when binding to a Nullable type that has no value. BindingExpression:Path=NotNewRecord; DataItem=null; target element is 'TextBox' (Name=''); target property is 'Visibility' (type 'Visibility')If I swap the CellTemplate out and use the DataMemberBidning property on the GridViewDataColumn then no binding error(s) occur - BUT I require the dual content hide/show feature.
I have also attempted to use the other types of GridViewColumn available but that seemed to make little difference in the outcome.
Can you help me determin why my non-null ItemsSource and its non-null properties are not being friendly with your RadGridView's columns?
Cheers,