![](/img/trans.png)
[英]How can i update my data in xamarin without closing and opening my app?
[英]How could I close my sidebar without closing my app in C# xamarin forms android?
I'm working with C# xamarin forms android and I'm trying to close my sidebar when the user touches de backbuttom but I'm not able to do it. 相反,我的應用程序關閉。
首頁.xaml.cs代碼:
public partial class HomePage : ContentPage
{
string[] subs;
public HomePage()
{
//NavigationPage.SetHasBackButton(this, false);
InitializeComponent();
}
protected override bool OnBackButtonPressed()
{
return true;
}
}
我的側邊欄 AppShell.xaml.cs 代碼:
public partial class AppShell : Xamarin.Forms.Shell
{
public AppShell()
{
InitializeComponent();
nameuser.Title = Preferences.Get("displayName", "Default");
versionadoAPP.Text = "v" + $"{VersionTracking.CurrentBuild}.{VersionTracking.CurrentVersion}";
}
protected override bool OnBackButtonPressed()
{
return true;
}
}
我的應用程序的圖像:
我該如何解決? 非常感謝你!
最簡單的方法是設置彈出顯示屬性。
嘗試這樣的事情:
Shell.Current.FlyoutIsPresented = false;
祝你好運!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.