private void FormGroup_CollectSize(object sender, FormGroupCollectSizeEventArgs e) { if (_headerControl != null) { if (sender is FormGroup formGroup && formGroup != this && GroupName == formGroup.GroupName && Window.GetWindow(formGroup) == Window.GetWindow(this)) { if (e.Orientation == Orientation.Horizontal) { var width = GetComputedWidth(false); e.Maximuim = Math.Max(e.Maximuim, width); } else { var height = GetComputedHeight(false); e.Maximuim = Math.Max(e.Maximuim, height); } } } }
private void DeteminingSize() { if (_headerControl == null) { return; } var size = 0d; if (Orientation == Orientation.Horizontal) { size = GetComputedWidth(false); var internalHeight = GetComputedHeight(true); if (double.IsNaN(internalHeight)) { FrameworkElementUtil.BindingProperty(this, InternalHeaderHeightProperty, this, ActualHeightProperty); } else { InternalHeaderHeight = internalHeight; } } else { size = GetComputedHeight(false); var internalWidth = GetComputedWidth(true); if (double.IsNaN(internalWidth)) { FrameworkElementUtil.BindingProperty(this, InternalHeaderWidthProperty, this, ActualWidthProperty); } else { InternalHeaderWidth = internalWidth; } } var collectSizeEventArgs = new FormGroupCollectSizeEventArgs(Orientation, size); if (!string.IsNullOrEmpty(GroupName)) { CollectSize?.Invoke(this, collectSizeEventArgs); } if (Orientation == Orientation.Horizontal) { if (collectSizeEventArgs.Maximuim == InternalHeaderWidth) { return; } InternalHeaderWidth = collectSizeEventArgs.Maximuim; } else { if (collectSizeEventArgs.Maximuim == InternalHeaderHeight) { return; } InternalHeaderHeight = collectSizeEventArgs.Maximuim; } if (!string.IsNullOrEmpty(GroupName)) { var sizeDeteminedEventArgs = new FormGroupSizeDeterminedEventArgs(Orientation, collectSizeEventArgs.Maximuim); SizeDetemined?.Invoke(this, sizeDeteminedEventArgs); } }