XamDataGrid ComboxField使用问题

gf3813 2016-03-28 02:01:21
比如有个结构
public class AAA
{
public int ccc;
public 结构bbb;
}
public 结构 bbb
{
int ddd
}
public 结构 eee
{
// comboxlist用结构
}
XamDataGrid和一个 结构AAA绑定,
XamDataGrid下有两个空间 text和comboxField
他们分别和ccc,bbb绑定应该如何绑定
求教 大神
...全文
420 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
gf3813 2016-03-30
  • 打赏
  • 举报
回复
这个我也不会
原创: 本示例以一个共享控件为例,对样式资源加以说明,方便对样式有个更深层次的了解,主要有以下特点: 1.使用简单MVVM模式,使用命令代替UI事件。 2.使用到各种样式。 3.将控件共享化。 4.使用命令触发器。 public MainWindow() { InitializeComponent(); ActionataGrid, DelegateCommand>, string> bindData = (xamDataGrid, selectedRowsCommand, rowsPropertyName) => { BindingOperations.SetBinding(xamDataGrid, DataGrid.ItemsSourceProperty, new Binding { Source = ViewModel, Path = new PropertyPath(rowsPropertyName), Mode = BindingMode.OneWay }); // TODO : 全选命令未绑定到vm var contextMenu = (MenuItem)xamDataGrid.ContextMenu.Items[0]; contextMenu.Command = ApplicationCommands.SelectAll; contextMenu.Header = "全选"; var commandTrigger = (EventCommandTrigger)CommandSource.GetTriggers(xamDataGrid); BindingOperations.SetBinding(commandTrigger, EventCommandTrigger.CommandParameterProperty, new Binding { Source = xamDataGrid.SelectedItems, }); commandTrigger.Command = selectedRowsCommand; commandTrigger.RoutedEvent = DataGrid.SelectionChangedEvent; commandTrigger.UpdateCommandParameter = true; }; const string SHARED_DATAGRID = "xgShared"; var viewModel = (MainViewModel)ViewModel; var xdgSystem = (DataGrid)Resources[SHARED_DATAGRID]; bindData(xdgSystem, viewModel.SelectedSystemRowsCommand, "SystemRows"); placeSystem.Content = xdgSystem; var xdgImport = (DataGrid)Resources[SHARED_DATAGRID]; bindData(xdgImport, viewModel.SelectedImportRowsCommand, "ImportRows"); placeImport.Content = xdgImport; }

13,347

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET技术前瞻
社区管理员
  • .NET技术前瞻社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧