0

エラー

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')..

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

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>

問題

編集テキストをクリックすると(行を編集モードにすると{鉛筆の図が横に表示されます})、SECUSERNAMEの内容が表示されます。

しかし、レコードを表示するだけの通常の状態では、テキストエディットは何も表示しません。

はい、デバッガーはsecusernameが無効であることを示していますが、なぜですか?これを正しくするために私は何をすべきですか?

4

1 に答える 1

1

次のようにバインディング コードを変更してみてください。

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

それはあなたのために働きますか?

于 2011-04-01T11:52:19.170 に答える