Custom element convention

Mar 28, 2011 at 9:59 PM


I'm trying to add a convention for the Silverlight Page control that will bind an attached property for the page title to the screen's DisplayName property.  I tried adding this code in my bootstrapper to create the convention:

ConventionManager.AddElementConvention<Page>(Page.VisibilityProperty, "DataContext", "Loaded")
    .ApplyBinding = (viewModelType, path, property, element, convention) =>
        BindingOperations.SetBinding(element, PageHelper.TitleProperty, new Binding("DisplayName"));

However the ApplyBinding action never gets called.  What am I doing wrong here?