private void FindEditorsInTabs(LayoutItemContainer group) { group.BeginUpdate(); LayoutGroup layoutGroup = group as LayoutGroup; if ((layoutGroup != null) && layoutGroup.IsInTabbedGroup) { foreach (BaseLayoutItem item in layoutGroup.Items) { if (item is XafLayoutControlItem) { PropertyEditor editor = ((WinLayoutManager)View.LayoutManager).FindViewItem((XafLayoutControlItem)item) as PropertyEditor; if (editor != null) { editorMap.Add(editor, item); editor.ValueStored += Editor_ValueStored; if (editor.PropertyValue is IBindingList) { ((IBindingList)editor.PropertyValue).ListChanged += PropertyEditorGroupHelper_ListChanged; } } } } } IEnumerable items = null; if (group is TabbedGroup) { items = ((TabbedGroup)group).TabPages; } else if (group is LayoutGroup) { items = ((LayoutGroup)group).Items; } if (items != null) { foreach (BaseLayoutItem child in items) { if (child is LayoutItemContainer) { FindEditorsInTabs((LayoutItemContainer)child); } } } group.EndUpdate(); }
public void HighlightTabs(LayoutItemContainer group, XafApplication application, DetailView view) { group.BeginUpdate(); LayoutGroup layoutGroup = group as LayoutGroup; if ((layoutGroup != null) && layoutGroup.IsInTabbedGroup) { bool isBold = false; foreach (BaseLayoutItem item in layoutGroup.Items) { LayoutControlItem layoutControlItem = item as LayoutControlItem; if (layoutControlItem == null) { continue; } PropertyEditor propertyEditor = FindPropertyEditor(view, layoutControlItem); object currentValue = propertyEditor != null?propertyEditor.MemberInfo.GetValue(propertyEditor.CurrentObject) : null; int index = layoutGroup.Text.IndexOf('('); if (index != -1) { if (layoutGroup.Text.EndsWith(")")) { layoutGroup.Text = layoutGroup.Text.Substring(0, index - 1); } } if (HighlightOptions.ShowCountsInTabs) { ICollection collection = currentValue as ICollection; if (collection != null) { int count = collection.Count; isBold = count > 0 && HighlightOptions.BoldTabsWithCounts; if (count != 0) { layoutGroup.Text = String.Format("{1} ({0})", count, layoutGroup.Text); } } else { isBold = currentValue != null && !String.IsNullOrEmpty(currentValue.ToString()) && HighlightOptions.BoldTabsWithCounts; } if (isBold) { break; } } } Font font = layoutGroup.AppearanceTabPage.Header.Font; layoutGroup.AppearanceTabPage.Header.Font = new Font(font, isBold ? FontStyle.Bold : FontStyle.Regular); layoutGroup.AppearanceTabPage.HeaderHotTracked.Font = new Font(font, isBold ? FontStyle.Bold : FontStyle.Regular); } IEnumerable items; if (group is TabbedGroup) { items = ((TabbedGroup)group).TabPages; } else { items = ((LayoutGroup)group).Items; } foreach (BaseLayoutItem item in items) { if (item is LayoutItemContainer) { HighlightTabs((LayoutItemContainer)item, application, view); } } group.EndUpdate(); }