具有加载功能的 Xamarin 基本内容页(或常见内容视图)

如何创建一个包含示例 a 的“基”,并使它成为应用程序中其他页面的基础?ContentPagebusy indicatorPage


我试图以这种方式做,但没有显示。busy indicator


基本页面:


<?xml version="1.0" encoding="utf-8" ?>

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"

             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

             xmlns:core="clr-namespace:SgatMobileV3.Core;assembly=SgatMobileV3"

             x:Class="SgatMobileV3.Core.BasePage">

    <ContentPage.Content>

        <Grid>

            <core:VolosLoadingView />

        </Grid>

    </ContentPage.Content>

</ContentPage>

忙碌指示器视图:


<?xml version="1.0" encoding="UTF-8"?>

<ContentView xmlns="http://xamarin.com/schemas/2014/forms"

             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

             xmlns:core="clr-namespace:SgatMobileV3.Core;assembly=SgatMobileV3"

             core:LocatorViewModel.AutoWireViewModel="true"

             x:Class="SgatMobileV3.Core.VolosLoadingView"

             xmlns:busyindicator="clr-namespace:Syncfusion.SfBusyIndicator.XForms;assembly=Syncfusion.SfBusyIndicator.XForms">


    <Grid>

     <Grid BackgroundColor="LightGray" Opacity="0.6" IsVisible="True" />

     <busyindicator:SfBusyIndicator

        IsBusy="True"

        IsVisible="True"

        x:Name="loading" AnimationType="DoubleCircle"

        ViewBoxWidth="150" ViewBoxHeight="150"

        TextColor="Green" BackgroundColor="Transparent"

        HorizontalOptions="Center" VerticalOptions="Center"/>       

     </Grid>

</ContentView>


我试图在基本页面中包含一个示例,但没有显示任何内容。label


POPMUISE
浏览 132回答 2
2回答

慕神8447489

我如何创建一个“基本”内容页面,其中包含一个繁忙的指示器,并让这个页面成为彼此页面的基础如果要在页面级别创建实例,在应用程序级别创建实例,也可以在页面级别创建实例,如下面的代码示例所示:ControlTemplateControlTemplate<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="SimpleTheme.HomePage">&nbsp; &nbsp; <ContentPage.Resources>&nbsp; &nbsp; &nbsp; &nbsp; <ResourceDictionary>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <ControlTemplate x:Key="TealTemplate">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </ControlTemplate>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <ControlTemplate x:Key="AquaTemplate">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </ControlTemplate>&nbsp; &nbsp; &nbsp; &nbsp; </ResourceDictionary>&nbsp; &nbsp; </ContentPage.Resources>&nbsp; &nbsp; <ContentView ... ControlTemplate="{StaticResource TealTemplate}">&nbsp; &nbsp; &nbsp; &nbsp; ...&nbsp; &nbsp; </ContentView></ContentPage>在页面级别添加 时,将 a 添加到 ContentPageControlTemplate 的实例中,这些实例包含在 ResourceDictionary 中。ControlTemplateResourceDictionary, and then the也可以使用代码,例如,来自doc的样本。

浮云间

您可以在代码中添加控件(在BasePage.cs文件中),我认为没有XAML解决方案。
打开App,查看更多内容
随时随地看视频慕课网APP