I am receiving the error "Invalid Binding Path; character 1 in 1" when I try to insert a column into a grid. This is causing problems in several areas of a complex application, however, I finally narrowed it down to a small sample of code that can reproduce it. In order to reproduce the error in my sample application below simply click the "Add Test Col" button at the top first and then click "Insert Test Col" second. The first button click is successful, the second one results in the error previously stated. I am using Q1 2011 and the issue seems to me to be somehow related to the UniqueName property and the Columns.Insert method. The Columns.Add method seems to work fine. The issue does not appear to be browser specific.
The xaml
The codebehind
Thanks,
-Josh
The xaml
<
UserControl
x:Class
=
"SpectrumSL.ucTest"
xmlns:telerik
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
DataContext
=
"{Binding RelativeSource={RelativeSource Self}}"
x:Name
=
"root"
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
Button
Grid.Row
=
"0"
x:Name
=
"btnAddTestCol"
Content
=
"Add Test Col"
Click
=
"btnAddTestCol_Click"
FontSize
=
"14"
/>
<
Button
Grid.Row
=
"1"
x:Name
=
"btnInsertTestCol"
Content
=
"Insert Test Col"
Click
=
"btnInsertTestCol_Click"
FontSize
=
"14"
/>
<
telerik:RadGridView
Grid.Row
=
"2"
x:Name
=
"TestGrid"
ItemsSource
=
"{Binding TestValues}"
/>
</
Grid
>
</
UserControl
>
The codebehind
Public
Class
ucTest
Inherits
UserControl
Public
Sub
New
()
InitializeComponent()
End
Sub
Private
Sub
ucNomination_Loaded(sender
As
Object
, e
As
System.Windows.RoutedEventArgs)
Handles
Me
.Loaded
TestValues.Add(
New
Test
With
{.TestProperty = 1})
End
Sub
Private
Sub
btnAddTestCol_Click(sender
As
System.
Object
, e
As
System.Windows.RoutedEventArgs)
Dim
col
As
New
GridViewDataColumn
col.UniqueName =
"1"
col.Header =
"Added Column"
TestGrid.Columns.Add(col)
End
Sub
Private
Sub
btnInsertTestCol_Click(sender
As
System.
Object
, e
As
System.Windows.RoutedEventArgs)
Dim
col
As
New
GridViewDataColumn
col.UniqueName =
"2"
col.Header =
"Inserted Column"
TestGrid.Columns.Insert(0, col)
End
Sub
Public
Property
TestValues()
As
New
ObservableCollection(Of Test)
Public
Class
Test
Public
Property
TestProperty()
As
Integer
End
Class
End
Class
Thanks,
-Josh