void dGrid_LoadRowDetailComplete(object sender, ActionCompletedEventArgs <UIElement> e) { if (this.EditForm.OperationType == OperationTypes.Audit) { IControlAction form = e.Result as IControlAction; form.InitControl(OperationTypes.Edit); } }
private void SetRowDetailTemplate() { if (this.orderDetailGridInfo.RowDetailDataPanel != null) { #region RowDetailTemplate DataTemplate dt = DataTemplateHelper.GetEmptyGrid(); this.ADGrid.RowDetailsTemplate = dt; this.ADGrid.LoadingRowDetails += (o, e) => { IDataPanel panel = this.orderDetailGridInfo.RowDetailDataPanel; IControlAction control = panel.GetUIElement(); Grid grid = e.DetailsElement as Grid; grid.Background = e.Row.Background; if (grid.Children.Count == 0) { Border border = new Border(); border.Style = (Style)Application.Current.Resources["DetailShow_1"]; grid.Children.Add(border); if (control.GetType() == typeof(DetailGrid)) { DetailGrid dgrid = control as DetailGrid; border.Child = dgrid; // dgrid.Margin = new Thickness(80, 0, 0, 0); control.InitControl(this.operationType); } else { border.Child = (control as UIElement); OperationTypes cOpType = this.operationType; if (this.operationType == OperationTypes.Audit) { cOpType = OperationTypes.Edit; } control.InitControl(cOpType); } } DependencyObject dObj = VisualTreeHelper.GetChild(e.DetailsElement,0); UIElement curControl = (dObj as Border).Child; if (curControl.GetType() == typeof(DetailGrid)) { DetailGrid dgrid = curControl as DetailGrid; string entityType = dgrid.OrderDetailGridInfo.OrderDetailEntityInfo.Entity.Type; FBEntity source = e.Row.DataContext as FBEntity; ; if (source != null) { ObservableCollection<FBEntity> list = source.GetRelationFBEntities(entityType); if (list.Count > 0) { dgrid.ItemsSource = list; } else { dgrid.Visibility = Visibility.Collapsed; } } } if (LoadRowDetailComplete != null) { ActionCompletedEventArgs<UIElement> args = new ActionCompletedEventArgs<UIElement>(curControl); LoadRowDetailComplete(o, args); } }; #endregion } }