我在 Xamarin.forms.Maps
中有一个 ContentView
,我在 ListView
中使用该视图。单击地图时我需要打开一个新页面。
我尝试如下:
MapClicked="MapClicked"
private async void MapClicked(object sender, MapClickedEventArgs e)
{
var item = (History)((Map)sender).BindingContext;
await Navigation.PushModalAsync(new Pages.Page1());
}
当我点击地图时,这些线被触发,但 Page1 没有打开。那么从 ContentPage
打开 ContentView
的确切方法是什么?
参考:Xamarin Forms: How to bind the position value of Xamarin.forms.Maps inside the ListView?
答案 0 :(得分:1)
您应该将 const app = ReactDOMServer.renderToString(<App />);
const helmet = Helmet.renderStatic()
const indexFile = path.resolve('./build/index.html');
fs.readFile(indexFile, 'utf8', (err, data) => {
let updated = data.replace('<div id="root"></div>', `<div id="root">${app}</div>`);
return res.send(updateHtmlContent(updated, helmet));
}
作为要导航的根页面。阅读更多信息:https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/navigation/hierarchical