C1TabControl and OnActivate Issues

Topics: UI Architecture
May 30, 2013 at 2:27 PM
Hi,

I have a MDI setup where the parent VM is defined with the type Conductor<Screen>.Collection.OneActive. Child view models are then added to the items collection. I am trying to then bind these view models as pages on a tab control, and we are using the C1TabControl for this. The control and views all display as expected however when I try to do some code on the OnActivate of one of my child view models this is not fired. If I change the tab control in the view to use the standard WPF tab control the OnActivate is fired.

I am using the following code to add the C1TabControl to the conversion manager;
            ConventionManager.AddElementConvention<C1TabControl>(C1TabControl.ItemsSourceProperty, "ItemsSource", "SelectionChanged")
                .ApplyBinding = (viewModelType, path, property, element, convention) =>
                {
                    if (!ConventionManager.SetBindingWithoutBindingOrValueOverwrite(viewModelType, path, property, element, convention, C1ItemsControl.ItemsSourceProperty))
                    {
                        return false;
                    }
                    
                    var tabControl = (C1TabControl)element;
                    if (tabControl.ContentTemplate == null
                        && tabControl.ContentTemplateSelector == null
                        && property.PropertyType.IsGenericType)
                    {

                        var itemType = property.PropertyType.GetGenericArguments().First();
                        if (!itemType.IsValueType && !typeof(string).IsAssignableFrom(itemType))
                        {
                            tabControl.ContentTemplate = ConventionManager.DefaultItemTemplate;

                            var Log = LogManager.GetLog(typeof(T));
                            if (Log != null)
                                Log.Info("ContentTemplate applied to {0}.", element.Name);
                        }
                    }

                    return true;
                };
Does anyone have any ideas as to why this might be ?

Many thanks in advance,

Neil.