I am still struggling to get my head around custom controls. Although I must say I havent designed many custom controls in c#. So far I have:
public class MasterDetailPage : Xamarin.Forms.MasterDetailPage
{
public static BindableProperty DetailProperty = BindableProperty.Create("DetailPageKey", typeof(string), typeof(MasterDetailPage), ViewModelLocator.DashBoardPage, BindingMode.TwoWay, null, null, null, null);
public MasterDetailPage()
{
if (this.Detail == null && DetailPageKey != null)
{
this.Detail = SimpleIoc.Default.GetInstance<IPageOperations>().InitialiseDetailPage((string)this.GetValue(DetailProperty));
this.Title = (this.Detail as Page).Title;
}
}
public string DetailPageKey
{
get
{
return (string)this.GetValue(DetailProperty);
}
set
{
this.SetValue(DetailProperty, value);
this.Detail = SimpleIoc.Default.GetInstance<IPageOperations>().InitialiseDetailPage((string)this.GetValue(DetailProperty));
}
}
At the moment I am Navigating and initializing pages through my IPageOperations interface. But where am I going wrong? I would expect it to work so that I could do DetailPageKey="{Binding myprop)" and it would work but currently it doesnt . It should be possible with little effort