Open
Description
openedon Jul 28, 2022
Description
when trying to link the ispresented property of the flyoutpage to a viewmodel the property does not take the changes with the binding
for example:
this is the view from FlyoutPage
<FlyoutPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Peleg.App.View"
xmlns:VMbinding="clr-namespace:Prueba.App.ViewModel"
x:Class="Prueba.App.View.SettingFlyoutPage"
IsPresented="{Binding FlyoutState, Mode=TwoWay}"
Title="SettingFlyoutPage">
<FlyoutPage.BindingContext>
<VMbinding:HomePageViewModel/> <!--En este codigo enlazamos el view model por medio de una variable para luego usarla como acceso a sus propiedades-->
</FlyoutPage.BindingContext>
<FlyoutPage.Flyout>
<local:SidebarPage x:Name="flyoutPage"/>
</FlyoutPage.Flyout>
<FlyoutPage.Detail>
<NavigationPage>
<x:Arguments>
<local:HomeDetailPage/>
</x:Arguments>
</NavigationPage>
</FlyoutPage.Detail>
</FlyoutPage>
this is my ViewModel
namespace Prueba.App.ViewModel
{
public class HomePageViewModel : BaseViewModel
{
bool flyoutstate;
public bool FlyoutState
{
get { return flyoutstate; }
set {
if (flyoutstate==value)
{ return; }
flyoutstate = value;
OnPropertyChanged();
}
}
public ICommand CommandBtnSearch { private set; get; }
public HomePageViewModel()
{
CommandBtnSearch = new Command(
execute:() =>
{
FlyoutState=true;
OnPropertyChanged();
},
canExecute:() =>
{
return !FlyoutState;
});
}
from here I link the command property
<ImageButton.GestureRecognizers>
<TapGestureRecognizer Command="{Binding CommandBtnSearch}"/>
</ImageButton.GestureRecognizers>
however, the change does not occur in the property.
Steps to Reproduce
- I create the view where I will link the command
- in the ViewModel i create the traditional property and i i create the command then at the constructor i initialize the command and run it
- link the ispresented property of the floyoutpage with the property that changes in the viewmodel
Version with bug
6.0.400
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 11, windows sdk 10
Did you find any workaround?
Not
Relevant log output
No response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment