文本框仅在行处于编辑模式时显示内容
问题描述:
我已经做了我能想到的所有事情,但是文本框只是不显示值.
I have done every thing I can think of, but the textbox just does not display the values.
我的错误在哪里?
<dxg:GridColumn FieldName="secUserName" Header="TRAIL">
<dxg:GridColumn.DisplayTemplate>
<ControlTemplate>
<StackPanel>
<TextBox Text="{Binding Path=Data.secUserName, Mode=TwoWay}" ></TextBox>
</StackPanel>
</ControlTemplate>
</dxg:GridColumn.DisplayTemplate>
和vb
'<!-- load the datagrid -->
Module1._Context.Load(Module1._Context.GetGESECsQuery())
GridControl1.AutoPopulateColumns = False
GridControl1.DataSource = Module1._Context.GESECs
答
我建议您使用我们的TextEdit代替标准TextBox:
I suggest that you use our TextEdit instead of the standard TextBox:
<dxg:GridColumn.DisplayTemplate>
<ControlTemplate>
<StackPanel>
<TextEdit EditValue="{Binding Path=DataContext.secUserName}"></TextEdit>
</StackPanel>
</ControlTemplate>
</dxg:GridColumn.DisplayTemplate>
如果这样做没有帮助,请删除模板,并确保网格具有绑定到secUserName字段的列,并在运行时显示数据.
If this does not help, please remove the template and make certain that the grid has a column bound to the secUserName field and it shows data in runtime.