仅在屏幕的一部分上显示模态页面
Show modal page on only a portion of the screen
我正在使用 Xamarin.Forms 开发 iPad 应用程序。
我希望我的设置页面是模态的,这样它就可以像弹出窗口一样覆盖在前一页上。
我一直在尝试我能找到的所有解决方案,其中大多数似乎都建议我通过按钮调用它:
await Navigation.PushModalAsync(ModalSettingsPage);
当我使用它时发生的事情是我的设置页面作为模态页面而不是弹出窗口从下方进入,它覆盖了整个屏幕。
这是我当前的代码:
//Setup button (action bar)
ToolbarItems.Add(new ToolbarItem
{
// Text = "Setup",
Icon = "settings1.png",
Order = ToolbarItemOrder.Default,
Command = new Command(() => Navigation.PushModalAsync(new ModalSettingsPage())) //Action to perfome on click , open modal view
});
还有,请问大家有什么好的方法来定位ToolbarItems吗?我有两个项目,希望每个项目都位于每一侧,但默认情况下它们都位于右侧。
Forms 中没有任何预制的东西可以为您提供我认为您想要的弹出窗口。相反,您必须创建它或使用第三方解决方案。例如,here 是一个可能适合您的 "popup" 实现。
随着 Forms 的发展(目前是 4.5.0),推送非全屏模式页面现在变得很简单。在 xaml 内容页面的代码隐藏中使用以下代码:
using Xamarin.Forms;
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
namespace YourAppWithAModalPage
{
public class ModalPage : ContentPage
{
public ModalPage()
{
// iOS Solution for a ModalPage (popup) which is not fullscreen
On<iOS>().SetModalPresentationStyle(UIModalPresentationStyle.FormSheet);
}
}
}
我正在使用 Xamarin.Forms 开发 iPad 应用程序。 我希望我的设置页面是模态的,这样它就可以像弹出窗口一样覆盖在前一页上。
我一直在尝试我能找到的所有解决方案,其中大多数似乎都建议我通过按钮调用它:
await Navigation.PushModalAsync(ModalSettingsPage);
当我使用它时发生的事情是我的设置页面作为模态页面而不是弹出窗口从下方进入,它覆盖了整个屏幕。
这是我当前的代码:
//Setup button (action bar)
ToolbarItems.Add(new ToolbarItem
{
// Text = "Setup",
Icon = "settings1.png",
Order = ToolbarItemOrder.Default,
Command = new Command(() => Navigation.PushModalAsync(new ModalSettingsPage())) //Action to perfome on click , open modal view
});
还有,请问大家有什么好的方法来定位ToolbarItems吗?我有两个项目,希望每个项目都位于每一侧,但默认情况下它们都位于右侧。
Forms 中没有任何预制的东西可以为您提供我认为您想要的弹出窗口。相反,您必须创建它或使用第三方解决方案。例如,here 是一个可能适合您的 "popup" 实现。
随着 Forms 的发展(目前是 4.5.0),推送非全屏模式页面现在变得很简单。在 xaml 内容页面的代码隐藏中使用以下代码:
using Xamarin.Forms;
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
namespace YourAppWithAModalPage
{
public class ModalPage : ContentPage
{
public ModalPage()
{
// iOS Solution for a ModalPage (popup) which is not fullscreen
On<iOS>().SetModalPresentationStyle(UIModalPresentationStyle.FormSheet);
}
}
}