为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

C#
POPMUISE 2022-08-20 17:13:24
如何创建一个包含示例 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
查看完整描述

2 回答

?
慕神8447489

TA贡献1780条经验 获得超1个赞

我如何创建一个“基本”内容页面,其中包含一个繁忙的指示器,并让这个页面成为彼此页面的基础


如果要在页面级别创建实例,在应用程序级别创建实例,也可以在页面级别创建实例,如下面的代码示例所示:ControlTemplateControlTemplate


<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="SimpleTheme.HomePage">

    <ContentPage.Resources>

        <ResourceDictionary>

            <ControlTemplate x:Key="TealTemplate">

                ...

            </ControlTemplate>

            <ControlTemplate x:Key="AquaTemplate">

                ...

            </ControlTemplate>

        </ResourceDictionary>

    </ContentPage.Resources>

    <ContentView ... ControlTemplate="{StaticResource TealTemplate}">

        ...

    </ContentView>

</ContentPage>

在页面级别添加 时,将 a 添加到 ContentPageControlTemplate 的实例中,这些实例包含在 ResourceDictionary 中。ControlTemplateResourceDictionary, and then the


也可以使用代码,例如,来自doc的样本。


查看完整回答
反对 回复 2022-08-20
?
浮云间

TA贡献1829条经验 获得超4个赞

您可以在代码中添加控件(在BasePage.cs文件中),我认为没有XAML解决方案。


查看完整回答
反对 回复 2022-08-20
  • 2 回答
  • 0 关注
  • 131 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号