DevEx preSS WPF电网必将列出&LT;串GT;使用MVVM [英] DevExpress WPF grid bound to List<String> using MVVM
问题描述
我试图做一些事情,应该是简单的,但认为我只是没有看到答案。
我有几个字符串的列表。
我想将其绑定到一个DevEx preSS DXGrid。
似乎网格表示行的正确数目,但不显示我的文本
我使用的MVVM百通,并已分开我的视图模型和视图。
感谢您的帮助。
下面是XAML code:
&LT; DXG:GridControl Grid.Row =0数据源={绑定路径=错误日志}&GT;
&LT; DXG:GridControl.Columns&GT;
&LT; DXG:页眉的GridColumn =错误日志AllowEditing =FALSE/&GT;
&LT; / DXG:GridControl.Columns&GT;
&LT; DXG:GridControl.View&GT;
&LT; DXG:TableView中NewItemRowPosition =无/&GT;
&LT; / DXG:GridControl.View&GT;
&LT; / DXG:GridControl&GT;
下面是视图模型code:
私人列表&LT;串GT; _errorLog;
公开名单&LT;串GT;错误日志
{
{返回_errorLog; }
组
{
_errorLog =价值;
OnPropertyChanged(错误日志);
}
}
您没有指定栏应该显示什么,所以它不会显示任何内容...
&LT; DXG:页眉的GridColumn =错误日志AllowEditing =FALSEDisplayMemberBinding ={结合}/&GT;
(注意,不是为装订路径:该列被绑定到字符串本身,而不是一个字符串的部件)
I am trying to do something that should be simple, but think I am just not seeing the answer.
I have a List with several strings.
I would like to bind it to a DevExpress DXGrid.
It appears that the grid is showing the correct number of row, but not displaying my text.
I am using the MVVm patern and have seperated my ViewModel and View.
Thanks for the help.
Here is the XAML code:
<dxg:GridControl Grid.Row="0" DataSource="{Binding Path=ErrorLog}" >
<dxg:GridControl.Columns>
<dxg:GridColumn Header="Error Log" AllowEditing="False" />
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView NewItemRowPosition="None" />
</dxg:GridControl.View>
</dxg:GridControl>
Here is the View Model Code:
private List<string> _errorLog;
public List<string> ErrorLog
{
get { return _errorLog; }
set
{
_errorLog = value;
OnPropertyChanged("ErrorLog");
}
}
You didn't specify what the column should display, so it's not displaying anything...
<dxg:GridColumn Header="Error Log" AllowEditing="False" DisplayMemberBinding="{Binding}" />
(note that there is not path for the binding: the column is bound to the string itself, not a member of the string)
这篇关于DevEx preSS WPF电网必将列出&LT;串GT;使用MVVM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!