最开始用Devexpress xaf Dashboard做界面的时候,DetailView界面里面的控件都无法编辑,后来解决了这个问题,记录下来供大家参考。

解决方法:创建ViewController指向对应的DashboardView,在VC中进行设置。

 protected override void OnActivated()
        {
            base.OnActivated();
            if (View.Id == "MyDashboardViewId")
            {
                foreach (DashboardViewItem item in View.GetItems<DashboardViewItem>())
                {
                    item.ControlCreated += Item_ControlCreated;
                }
            }
        }

        private void Item_ControlCreated(object sender, EventArgs e)
        {
            DashboardViewItem item = ((DashboardViewItem)sender);
            if (item.Frame.View.Id == "MyDashBoardDetailViewId")
            {
                dvcardno = (DetailView)item.Frame.View;
                IObjectSpace ios = dvcardno.ObjectSpace;
                var obj = ios.CreateObject<MyDashBoardDetailViewBO>();
                //可以给BO对应的属性赋值
                obj.billno= "编号";
                dvcardno.CurrentObject = obj;
                dvcardno.RefreshDataSource();
                dvcardno.ControlsCreated += Dvcardno_ControlsCreated;
            }
        }

  

01-02 15:03