Textbox only displays content when the row is in edit mode

痴心易碎 提交于 2020-01-17 03:38:27

问题


I have done every thing I can think of, but the textbox just does not display the values.

Where is my mistake?

 <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>

and in vb

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

回答1:


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>

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.



来源:https://stackoverflow.com/questions/5498765/textbox-only-displays-content-when-the-row-is-in-edit-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!