When dealing with complicated detailviews, often we have repeating fields, especially when dealing with weekly information. Thus i may have 7 attributes that are Mon_DailyBlurb, Tue_DailyBlurb etc… Currently the standard is to create tabs to separate daily attribute sets. SO, we augment captions to not repeat the day component… THEN within the field chooser we have a long list of attributes that are identical. This is very very complicated and time-consuming when re-arrangements are needed.
All that is needed is to augment the field listed as FieldName (Caption) … problem solved!
We have closed this ticket because another page addresses its subject:
WinForms - It is difficult to distinguish between fields with the same name in Customization FormsHow to show a full member path in the LayoutControl's Customization Form to avoid similar captions for properties with the same last member
Answers approved by DevExpress Support
It is possible to use the BaseLayoutItem.CustomizationFormText property to accomplish this task. Here is an example of how to show a dot-separated member caption including all sub-properties:
C#using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Utils;
using DevExpress.ExpressApp.Win.Layout;
public class CustomizationFormCaptionController : ViewController<DetailView> {
protected override void OnActivated() {
base.OnActivated();
((WinLayoutManager)View.LayoutManager).ItemCreated += CustomizationFormCaptionController_ItemCreated;
}
void CustomizationFormCaptionController_ItemCreated(object sender, ItemCreatedEventArgs e) {
if (e.ViewItem is PropertyEditor) {
e.Item.CustomizationFormText = CaptionHelper.GetFullMemberCaption(View.ObjectTypeInfo, (((PropertyEditor)e.ViewItem).MemberInfo).Name);
}
}
protected override void OnDeactivated() {
base.OnDeactivated();
((WinLayoutManager)View.LayoutManager).ItemCreated -= CustomizationFormCaptionController_ItemCreated;
}
}
Updated:
The solution for WinForms plain list views: T906747 - How to show a full member path in the Customization Form - for list views?
The solution for WinForms tree list views: T919737 - Win - Show a full member path in the Customization Form - for a TreeList
The common solution: S30014 - WinForms - It is difficult to distinguish fields with the same name in Customization Forms
Other Answers
Here's a hack & bodge - screenshot attached.
C#using System;
using System.Linq;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Layout;
using DevExpress.ExpressApp.Win.Layout;
using DevExpress.ExpressApp.Win.SystemModule;
using DevExpress.XtraLayout;
namespace LOB.XAF.Win.BugFixes
{
public class LOBWinLayoutManagerController : WinLayoutManagerController
{
#region LayoutControl
private LayoutControl _layoutControl;
protected LayoutControl LayoutControl
{
get { return _layoutControl; }
set
{
if (!ReferenceEquals(_layoutControl, value))
{
UnsubscribeLayoutControl();
_layoutControl = value;
SubscribeLayoutControl();
}
}
}
private void SubscribeLayoutControl()
{
if (this.LayoutControl != null)
this.LayoutControl.ItemAdded += LayoutControl_ItemAdded;
}
void LayoutControl_ItemAdded(object sender, EventArgs e)
{
XafLayoutControlItem i = sender as XafLayoutControlItem;
if (i != null && !i.CustomizationFormText.Contains('.'))
{
WinLayoutManager l = this.LayoutManager as WinLayoutManager;
if (l != null)
{
ViewItem vi = l.FindViewItem(i);
if (vi != null && vi.Id.Contains("."))
i.CustomizationFormText = "[" + vi.Id.Substring(0, vi.Id.IndexOf('.')) + "]." + i.CustomizationFormText;
}
}
}
private void UnsubscribeLayoutControl()
{
if (this.LayoutControl != null)
this.LayoutControl.ItemAdded -= LayoutControl_ItemAdded;
}
#endregion
#region DetailView
private DetailView DetailView
{
get { return base.View as DetailView; }
}
#endregion
#region LayoutManager
private LayoutManager LayoutManager
{
get
{
if (this.DetailView != null)
return this.DetailView.LayoutManager;
return null;
}
}
#endregion
#region OnActivated
protected override void OnActivated()
{
base.OnActivated();
this.LayoutControl = (XafLayoutControl)this.LayoutManager.Container;
if (this.LayoutControl == null)
base.View.ControlsCreated += this.View_ControlsCreated;
}
#endregion
#region OnDeactivated
protected override void OnDeactivated()
{
base.OnDeactivated();
this.LayoutControl = null;
}
#endregion
#region View_ControlsCreated
private void View_ControlsCreated(object sender, EventArgs e)
{
base.View.ControlsCreated -= this.View_ControlsCreated;
this.LayoutControl = (XafLayoutControl)this.LayoutManager.Container;
}
#endregion
}
}
Xafari (GalaktikaSoft) has a nice feature built in to take care of this. Plus a small extension in the model editor to dis/enable the way the caption is calculated on a per property basis. I love it!
Additionally, they have a way to deal with complex detailviews by using a small in-view navigation that shows separate detailviews inside the original detailview. Looks promising too! It also allows you to reuse properties in the 'same detailview' .
And they provide decent documentation !
This seems like a very very easy fix. My suggestion should cover all the duplicates. Tis simply the display caption that gets set, augment it as outlined, as we are good to go! Done by noon? :)
Still waiting Drew ;)
I'd be happy with a tooltip which gave some indication of property path.
So, a +1 from me for this functionality to be implemented *formally*.
+1 from me too