silverlightdata-bindingdevexpressgridcontrol

The VS10 debugger says it cannot find the datasource column in Silverlight application


The error

System.Windows.Data Error: BindingExpression path error: 'secUserName' property not found on 'DevExpress.Xpf.Grid.EditGridCellData' 'DevExpress.Xpf.Grid.EditGridCellData' (HashCode=2852273). BindingExpression: Path='secUserName' DataItem='DevExpress.Xpf.Grid.EditGridCellData' (HashCode=2852273); target element is 'DevExpress.Xpf.Editors.TextEdit' (Name=''); target property is 'EditValue' (type 'System.Object')..
System.Windows.Data Error: BindingExpression path error: 'secUserName' property not found on 'DevExpress.Xpf.Editors.TextEdit' 'DevExpress.Xpf.Editors.TextEdit' (HashCode=19675928). BindingExpression: Path='secUserName' DataItem='DevExpress.Xpf.Grid.EditGridCellData' (HashCode=2852273); target element is 'DevExpress.Xpf.Editors.TextEdit' (Name=''); target property is 'EditValue' (type 'System.Object')..

The vb.net

Public Sub New()
        InitializeComponent()
        Me.Title = ApplicationStrings.HomePageTitle

        '<!-- load the datagrid -->
        Module1._Context.Load(Module1._Context.GetGESECsQuery())
        GridControl1.DataSource = Module1._Context.GESECs
        GridControl1.DataContext = Module1._Context.GESECs

    End Sub

The XAML

 <dxg:GridColumn Header="TRAIL" FieldName="secUserName" >
 <dxg:GridColumn.DisplayTemplate>
 <ControlTemplate>
 <StackPanel>
 <dxe:TextEdit  EditValue="{Binding  Path=secUserName}"></dxe:TextEdit>
 </StackPanel>
 </ControlTemplate>
 </dxg:GridColumn.DisplayTemplate>
 </dxg:GridColumn>

Problem

When the edittext is clicked (there by bringing the row in edit mode {with the pencil diagram on its side}) the content of the SECUSERNAME is displayed

But in the normal condition of just displaying the records, the textedit does not display anything.

Yes, the debugger show that the secusername is not valid, but why? What should I do to make this right?


Solution

  • Please try to change your binding code as follows:

    "{Binding Path= DisplayText, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
    

    Does it work for you?