Exemple #1
0
        public void ModifyInstanceGridView(XpandXafGridView masterGridView, int rowHandle, int relationIndex, IModelListView masterModelListView, List<IMasterDetailRule> masterDetailRules) {
            var modelDetailRelationCalculator = new ModelDetailRelationCalculator(masterModelListView, masterGridView, masterDetailRules);
            bool isRelationSet = modelDetailRelationCalculator.IsRelationSet(rowHandle, relationIndex);
            if (isRelationSet) {
                IModelListView childModelListView = modelDetailRelationCalculator.GetChildModelListView(rowHandle, relationIndex);
                Window window = _xafApplication.CreateWindow(TemplateContext.View, null, true, false);
                ListView listView = GetListView(modelDetailRelationCalculator, rowHandle, relationIndex, childModelListView);
                var detailXafGridView = (XpandXafGridView)masterGridView.GetDetailView(rowHandle, relationIndex);
                ((XpandGridListEditor)listView.Editor).CustomGridViewCreate +=
                    (o, eventArgs) => {
                        eventArgs.Handled = true;
                        eventArgs.GridView = detailXafGridView;
                        eventArgs.GridControl.DataSource = detailXafGridView.DataSource;
                    };

                EventHandler[] listViewOnControlsCreated = { null };
                listViewOnControlsCreated[0] = (sender, args) => {
                    detailXafGridView.MasterFrame = masterGridView.MasterFrame ?? _masterFrame;
                    detailXafGridView.Window = window;
                    detailXafGridView.GridControl = masterGridView.GridControl;
                    listView.ControlsCreated -= listViewOnControlsCreated[0];
                };
                listView.ControlsCreated += listViewOnControlsCreated[0];
                ((PropertyCollectionSource)listView.CollectionSource).MasterObject = masterGridView.GetRow(rowHandle);
                window.SetView(listView);
            }
        }
Exemple #2
0
        public void ModifyInstanceGridView(XpandXafGridView masterGridView, int rowHandle, int relationIndex, IModelListView masterModelListView, List <IMasterDetailRule> masterDetailRules)
        {
            var  modelDetailRelationCalculator = new ModelDetailRelationCalculator(masterModelListView, masterGridView, masterDetailRules);
            bool isRelationSet = modelDetailRelationCalculator.IsRelationSet(rowHandle, relationIndex);

            if (isRelationSet)
            {
                IModelListView childModelListView = modelDetailRelationCalculator.GetChildModelListView(rowHandle, relationIndex);
                Window         window             = _xafApplication.CreateWindow(TemplateContext.View, null, true, false);
                ListView       listView           = GetListView(modelDetailRelationCalculator, rowHandle, relationIndex, childModelListView);
                var            detailXafGridView  = (XpandXafGridView)masterGridView.GetDetailView(rowHandle, relationIndex);
                ((XpandGridListEditor)listView.Editor).CustomGridViewCreate +=
                    (o, eventArgs) => {
                    ((XpandGridListEditor)o).DataSource = detailXafGridView.DataSource;
                    eventArgs.Handled  = true;
                    eventArgs.GridView = detailXafGridView;
                    eventArgs.GridControl.DataSource = detailXafGridView.DataSource;
                };

                EventHandler[] listViewOnControlsCreated = { null };
                listViewOnControlsCreated[0] = (sender, args) => {
                    detailXafGridView.MasterFrame = masterGridView.MasterFrame ?? _masterFrame;
                    detailXafGridView.Window      = window;
                    detailXafGridView.GridControl = masterGridView.GridControl;
                    listView.ControlsCreated     -= listViewOnControlsCreated[0];
                };
                listView.ControlsCreated += listViewOnControlsCreated[0];
                ((PropertyCollectionSource)listView.CollectionSource).MasterObject = masterGridView.GetRow(rowHandle);
                window.SetView(listView);
            }
        }
Exemple #3
0
 void ViewOnMasterRowEmpty(object sender, MasterRowEmptyEventArgs e)
 {
     if (View.Id != "MasterDetailAtAnyLevelCustomer_ListView")
     {
         Debug.Print("");
     }
     if (e.RelationIndex > -1)
     {
         var modelDetailRelationCalculator = new ModelDetailRelationCalculator(View.Model, (XpandXafGridView)sender, MasterDetailRules);
         e.IsEmpty = !modelDetailRelationCalculator.IsRelationSet(e.RowHandle, e.RelationIndex);
     }
 }
Exemple #4
0
 XpandXafGridView GetLevelDefaultViewCore(IModelListView masterModelListView, XpandXafGridView masterGridView, int rowHandle, int relationIndex, List<IMasterDetailRule> masterDetailRules) {
     var modelDetailRelationCalculator = new ModelDetailRelationCalculator(masterModelListView, masterGridView, masterDetailRules);
     bool isRelationSet = modelDetailRelationCalculator.IsRelationSet(rowHandle, relationIndex);
     if (isRelationSet) {
         IModelListView childModelListView = modelDetailRelationCalculator.GetChildModelListView(rowHandle, relationIndex);
         ListView listView = GetListView(modelDetailRelationCalculator, rowHandle, relationIndex, childModelListView);
         XpandXafGridView defaultXpandXafGridView = null;
         EventHandler[] listViewOnControlsCreated = { null };
         listViewOnControlsCreated[0] = (sender, args) => {
             defaultXpandXafGridView = (XpandXafGridView)((GridListEditor)((XpandListView)sender).Editor).GridView;
             listView.ControlsCreated -= listViewOnControlsCreated[0];
         };
         listView.ControlsCreated += listViewOnControlsCreated[0];
         listView.CreateControls();
         return defaultXpandXafGridView;
     }
     return null;
 }
Exemple #5
0
        XpandXafGridView GetLevelDefaultViewCore(IModelListView masterModelListView, XpandXafGridView masterGridView, int rowHandle, int relationIndex, List <IMasterDetailRule> masterDetailRules)
        {
            var  modelDetailRelationCalculator = new ModelDetailRelationCalculator(masterModelListView, masterGridView, masterDetailRules);
            bool isRelationSet = modelDetailRelationCalculator.IsRelationSet(rowHandle, relationIndex);

            if (isRelationSet)
            {
                IModelListView   childModelListView        = modelDetailRelationCalculator.GetChildModelListView(rowHandle, relationIndex);
                ListView         listView                  = GetListView(modelDetailRelationCalculator, rowHandle, relationIndex, childModelListView);
                XpandXafGridView defaultXpandXafGridView   = null;
                EventHandler[]   listViewOnControlsCreated = { null };
                listViewOnControlsCreated[0] = (sender, args) => {
                    defaultXpandXafGridView   = (XpandXafGridView)((GridListEditor)((XpandListView)sender).Editor).GridView;
                    listView.ControlsCreated -= listViewOnControlsCreated[0];
                };
                listView.ControlsCreated += listViewOnControlsCreated[0];
                listView.CreateControls();
                return(defaultXpandXafGridView);
            }
            return(null);
        }
Exemple #6
0
 ListView GetListView(ModelDetailRelationCalculator modelDetailRelationCalculator, int rowHandle, int relationIndex, IModelListView childModelListView) {
     var listViewBuilder = new ListViewBuilder(modelDetailRelationCalculator, _objectSpace);
     return listViewBuilder.CreateListView(childModelListView, rowHandle, relationIndex);
 }
Exemple #7
0
 public ListViewBuilder(ModelDetailRelationCalculator modelDetailRelationCalculator, IObjectSpace objectSpace) {
     _modelDetailRelationCalculator = modelDetailRelationCalculator;
     _objectSpace = objectSpace;
 }
Exemple #8
0
 public ListViewBuilder(ModelDetailRelationCalculator modelDetailRelationCalculator, IObjectSpace objectSpace)
 {
     _modelDetailRelationCalculator = modelDetailRelationCalculator;
     _objectSpace = objectSpace;
 }
 void ViewOnMasterRowEmpty(object sender, MasterRowEmptyEventArgs e) {
     if (e.RelationIndex > -1) {
         var modelDetailRelationCalculator = new ModelDetailRelationCalculator(View.Model, (IMasterDetailXafGridView)sender, RequestRules.Invoke(Frame));
         e.IsEmpty = !modelDetailRelationCalculator.IsRelationSet(e.RowHandle, e.RelationIndex);
     }
 }
Exemple #10
0
        ListView GetListView(ModelDetailRelationCalculator modelDetailRelationCalculator, int rowHandle, int relationIndex, IModelListView childModelListView)
        {
            var listViewBuilder = new ListViewBuilder(modelDetailRelationCalculator, _objectSpace);

            return(listViewBuilder.CreateListView(childModelListView, rowHandle, relationIndex, _xafApplication));
        }