Convention for TabbedGroup

Mar 23, 2015 at 1:59 PM
Using the DocumentGroup Convention from Caliburn.Micro.DevExpress, I have attempted to use for TabbedGroup. All is working so far except I cannot manage to get the Screen.DisplayName to appear as the Tab Caption. Does anyone have a working convention for TabbedGroup?
ConventionManager.AddElementConvention<DocumentGroup>(DocumentGroup.ItemsSourceProperty, "ItemsSource", "SelectedItemChanged").ApplyBinding = (viewModelType, path, property, element, convention) =>
{
var bindableProperty = convention.GetBindableProperty(element);
if (!ConventionManager.SetBindingWithoutBindingOverwrite(viewModelType, path, property, element, convention, bindableProperty))
return false;

var documentGroup = (DocumentGroup)element;
if (documentGroup.ItemContentTemplate == null
    && documentGroup.ItemContentTemplateSelector == null
    && property.PropertyType.IsGenericType)
{
var itemType = property.PropertyType.GetGenericArguments().First();
if (!itemType.IsValueType && !typeof(string).IsAssignableFrom(itemType))
{
    documentGroup.ItemContentTemplate = ConventionManager.DefaultItemTemplate;
    Log.Info("ContentTemplate applied to {0}.", documentGroup.Name);
    if (documentGroup.ItemStyle == null)
    {
    Style style = new Style(typeof(DocumentPanel));
    style.Setters.Add(new Setter(DocumentPanel.CloseCommandProperty, new Binding("CloseCommand")));
    documentGroup.ItemStyle = style;
    Log.Info("ItemStyle applied to {0}.", documentGroup.Name);
    }
}
}

ConventionManager.ConfigureSelectedItem(element, DocumentGroup.SelectedTabIndexProperty, viewModelType, path);

ConventionManager.ApplyHeaderTemplate(documentGroup, DocumentGroup.ItemCaptionTemplateProperty, DocumentGroup.ItemCaptionTemplateSelectorProperty, viewModelType);

return true;
};