Hello,
i need to link the property ispresented from flyoutpage with viewmode
You need to bind the same viewmodel for your View
and FlyoutPage
. After that, you can link the property between FlyoutPage
and View
You created a viewmodel called HomePageViewModel
, please create a Singleton Pattern for your HomePageViewModel
like following code.
public static class ViewModelLocator
{
private static HomePageViewModel _myViewModel = new HomePageViewModel();
public static HomePageViewModel HomePageViewModelInstance
{
get
{
return _myViewModel;
}
}
}
Then remove <FlyoutPage.BindingContext>
in your XAML. Setting bindingContext
in your <FlyoutPage>
background code.
BindingContext = ViewModelLocator.HomePageViewModelInstance;
Please set bindingContext
in your <FlyoutPage>
background code as well. For example, I put <ImageButton>
in the ContactsPage
, So I add BindingContext
like following code.
public ContactsPage()
{
InitializeComponent();
BindingContext = ViewModelLocator.HomePageViewModelInstance;
}
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.