Android Forms-ControlTemplate不';显示内容演示器
我试图使用一个ControlTemplate,这样我可以在每一页上都有一个页脚,但每当我使用该模板时,只会显示该模板,页面内容就会消失。这就好像Android Forms-ControlTemplate不';显示内容演示器,android,ios,xamarin,xamarin.forms,Android,Ios,Xamarin,Xamarin.forms,我试图使用一个ControlTemplate,这样我可以在每一页上都有一个页脚,但每当我使用该模板时,只会显示该模板,页面内容就会消失。这就好像ContentPresenter没有呈现页面内容,只有模板内容。我一直在使用以使模板工作,但没有用 以下是我的模板代码: <Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
ContentPresenter
没有呈现页面内容,只有模板内容。我一直在使用以使模板工作,但没有用
以下是我的模板代码:
<Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="TestApp.App">
<Application.Resources>
<ResourceDictionary>
<ControlTemplate x:Key="MainFooter">
<Grid>
<ContentPresenter/>
<Label Text="Template footer" FontSize="24"/>
</Grid>
</ControlTemplate>
</ResourceDictionary>
</Application.Resources>
</Application>
在我的头撞到墙上一段时间后,当我在模拟器中启动应用程序时,页面内容似乎已经呈现出来了
应用ControlTemplate后,预览器仅显示ControlTemplate,而不显示页面内容。很可能是Visual Studio中的一个bug,所以进行了一些挖掘:
我正在使用VisualStudio7.7.4和Xamarin 5.2.1.15。我想,每当我想预览我的页面时,我就得把ControlTemplate取下来。在我的头撞了一段时间后,在模拟器中启动应用程序后,页面内容似乎已经呈现出来了
应用ControlTemplate后,预览器仅显示ControlTemplate,而不显示页面内容。很可能是Visual Studio中的一个bug,所以进行了一些挖掘:
我正在使用VisualStudio7.7.4和Xamarin 5.2.1.15。我想,每当我想预览我的页面时,我就必须去掉ControlTemplate
<ContentPage Title="Test" xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TestApp.Login">
<ContentView ControlTemplate="{StaticResource MainFooter}" Padding="0, 20, 0, 0">
<StackLayout VerticalOptions="CenterAndExpand">
<Label Text="Page content" HorizontalOptions="Center"/>
</StackLayout>
</ContentView>
</ContentPage>