Having thought about this further and additional researching, I think my workaround is probably the best solution. When I use FeshMvvm's PushPageModel() method to display the page, it creates instances of the page and the page model, then binds them. Therefore the binding has not yet occurred during the construction of either the page or the page model, and so if the behaviour is assigned during the page construction (xaml or in constructor), then the binding is just not there yet
public async Task PushPageModel<T, TPage> (object data, bool modal = false, bool animate = true) where T : FreshBasePageModel where TPage : Page
{
T pageModel = FreshIOC.Container.Resolve<T> ();
TPage page = FreshIOC.Container.Resolve<TPage>();
FreshPageModelResolver.BindingPageModel(data, page, pageModel);
await PushPageModelWithPage(page, pageModel, data, modal, animate);
}
public static Page BindingPageModel(object data, Page targetPage, FreshBasePageModel pageModel)
{
pageModel.WireEvents (targetPage);
pageModel.CurrentPage = targetPage;
pageModel.CoreMethods = new PageModelCoreMethods (targetPage, pageModel);
pageModel.Init (data);
targetPage.BindingContext = pageModel;
return targetPage;
}
I have proven that if I define both the binding context and the behaviour assignment in xaml, then my page model is available during the behaviour's OnAttachedTo()
<local:HandheldBasePage.BindingContext>
<models:SelectMachinePageModel />
</local:HandheldBasePage.BindingContext>
<local:HandheldBasePage.Behaviors>
<behaviours:SelectMachineListViewFilteringBehaviour/>
</local:HandheldBasePage.Behaviors>
However since I am using FreshMvvm's PushPageModel, this does cause 2 instances of my page model being created (once due to the xaml declaration, and once due to FreshMvvm)
So I no longer suspect this to be a Syncfusion defect, and will continue to use my workaround.
Will leave the thread here in case anybody has any other suggestions, or in case it helps anoyone else.
Paul