小编Cfu*_*fun的帖子

对链表使用 list<type> 和指针(经典 C)之间的区别

使用内置std::list而不是自己的基于指针的链表实现的优缺点是什么?

是否有一些特殊情况,其中一个比另一个更受欢迎?

c c++ linked-list

1
推荐指数
1
解决办法
180
查看次数

如何导航到具有 Shell 弹出菜单的新页面?

我需要导航到一个页面,该页面将有 shell 弹出菜单,但我不需要它作为菜单中的项目出现。

我尝试过路由页面

Routing.RegisterRoute("cart", typeof(Cart));
Run Code Online (Sandbox Code Playgroud)

然后使用

Shell.Current.GoToAsync("///cart");
Run Code Online (Sandbox Code Playgroud)

但它抛出一个错误,告诉我堆栈中唯一的页面。微软文档没有帮助。

全局路由当前不能是堆栈上的唯一页面,因此不支持到全局路由的绝对路由。现在,只需导航至:cart/

当我尝试时

Shell.Current.Navigation.PushAsync(new NavigationPage(new Cart()));
Run Code Online (Sandbox Code Playgroud)

它有效,但顶部栏是默认颜色并且菜单按钮不存在。另外,我尝试将购物车作为新页面推送,没有new NavigationPage(),顶栏没有变化,但菜单按钮充当后退按钮,即使我设置了行为

<Shell.BackButtonBehavior>
        <BackButtonBehavior IconOverride="back.png"/>
</Shell.BackButtonBehavior>
Run Code Online (Sandbox Code Playgroud)

xamarin xamarin.forms xamarin.forms.shell

1
推荐指数
1
解决办法
8539
查看次数

只有圆角底角?

我试图让我Stacklayout的背景变圆(只有左右底边)。我正在寻找如何搜索,但无法确定。我该怎么做?

在此处输入图片说明

c# xaml xamarin xamarin.forms

1
推荐指数
1
解决办法
282
查看次数

InverseBoolConverter 像标记扩展一样使用,但不是从 MarkupExtension 派生的。XLS0505 XAML

我正在使用 Xamarin Forms 并尝试实现一个加载叠加层,该叠加层将显示文本,显示旋转的东西并禁用按钮。

由于加载时需要禁用按钮,我正在尝试使用 InverseBoolConverter

它在 iOS 上工作正常(给出警告,但我太酷了,不在乎),Android 却给出错误, Error XLS0505 Type 'Helpers:InverseBoolConverter' is used like a markup extension but does not derive from MarkupExtension. 并且构建机制不够酷,无法构建它,所以我遇到了问题。

XAML:

xmlns:Helpers="clr-namespace:xxx.MobileApp.Converters"
....

<AbsoluteLayout VerticalOptions="Fill">
    <Grid AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1" BackgroundColor="White">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <ScrollView Grid.Row="1">
        <StackLayout Orientation="Vertical" Padding="30,-80,30,24" Spacing="10">
            <Image x:Name="previewImage" Source="{Binding PreviewImage}" IsVisible="false" />
            <Grid VerticalOptions="CenterAndExpand">
                <Grid.RowDefinitions>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                </Grid.RowDefinitions>
            <Button Padding="20"
                    Margin="0,0,0,5" 
                    Text="&#xf030;"
                    FontSize="40"
                    VerticalOptions="EndAndExpand"
                    Grid.Row="1"
                    IsEnabled="{Binding IsLoading, Converter={Helpers:InverseBoolConverter}}"
                    Command="{Binding OpenCameraCommand}"                        
                    Style="{StaticResource GrayButtonWhiteText}" 
                    FontFamily="{StaticResource FontAwesomeSolid}"/>
            <Button …
Run Code Online (Sandbox Code Playgroud)

c# xaml converters xamarin xamarin.forms

1
推荐指数
1
解决办法
2695
查看次数

当前上下文中不存在名称“InitializeComponent”

我知道这个错误有很多答案,但它们都是一些系统错误或类似的错误。我刚刚创建了这个应用程序,它运行良好。然后我添加了一个视图模型来处理我在注册和登录页面之间的导航,在 login/register.xaml 中我更新了文本以了解我在哪个页面上。但现在InitializeComponent是不被认可。

我只放了注册页面,因为登录是一样的,但登录名是:

using Xamarin.Forms;

namespace Appointments.Views
{
    public partial class RegisterPage : ContentPage
    {
        public RegisterPage()
        {
            InitializeComponent();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

和视图模型:

using Appointments.Views;
using MvvmHelpers;
using MvvmHelpers.Commands;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;

namespace Appointments.ViewModels
{
    public class RegLogViewModel : BaseViewModel
    {   
        public AsyncCommand GoToRegisterCommand;
        public AsyncCommand GoToLoginCommand;
        RegLogViewModel()
        {
            GoToLoginCommand = new AsyncCommand(GoToLogin);
            GoToRegisterCommand = new AsyncCommand(GoToRegister);
        }

        async Task GoToRegister()
        {
            await Shell.Current.GoToAsync($"//{ nameof(RegisterPage)}");
        }

        async Task GoToLogin()
        { …
Run Code Online (Sandbox Code Playgroud)

c# xaml code-behind xamarin xamarin.forms

1
推荐指数
1
解决办法
50
查看次数

如果在 x 时间内没有用户交互(用户空闲),则导航回主页

我正在开发一个自我管理应用程序,我需要实现一个不活动计时器或类似的东西来了解用户是否空闲(在 x 时间内不与视图交互),因此当发生这种情况时,它会返回主页。

这可能吗?已检查应用程序生命周期文档,但没有找到任何相关信息。

我正在考虑为每个视图制作一个计时器,当时间到来时 x 重定向,但它似乎不太理想。有没有办法将其直接集成到应用程序中,或者我真的必须为每个视图设置一个计时器吗?

抱歉,如果我的问题不清楚。请询问,如果没有意义我可以更新。

c# android timer maui .net-maui

1
推荐指数
1
解决办法
764
查看次数

如何在 xamarin 表单中自动大写键盘/条目

我有两个条目用户名和密码。用户名和密码总是大写。如何强制键盘或输入项,当我键入内容时,文本将变为大写?

<Frame StyleClass="lpframe" x:Name="usernameFrame" CornerRadius="5" BorderColor="Transparent" HasShadow="False">
                <StackLayout>
                    <Label Text="USERNAME" StyleClass="lbl-login">
                        <Label.FontFamily>
                            <OnPlatform x:TypeArguments="x:String">
                                <On Platform="Android" Value="OpenSans-Semibold.ttf#OpenSans-Semibold"/>
                            </OnPlatform>
                        </Label.FontFamily>
                    </Label>
                    <local:CustomEntry Placeholder="Username" PlaceholderColor="#879baa" Unfocused="entUser_Unfocused" StyleClass="form-control" ReturnType="Next" x:Name="entUser">
                        <local:CustomEntry.FontFamily>
                            <OnPlatform x:TypeArguments="x:String">
                                <On Platform="Android" Value="OpenSans-Regular.ttf#OpenSans-Regular"/>
                            </OnPlatform>
                        </local:CustomEntry.FontFamily>
                    </local:CustomEntry>
                </StackLayout>
            </Frame>
            <Frame StyleClass="lpframe" x:Name="passwordFrame" CornerRadius="5" BorderColor="Transparent" HasShadow="False">
                <StackLayout>
                    <Label Text="PASSWORD" StyleClass="lbl-login">
                        <Label.FontFamily>
                            <OnPlatform x:TypeArguments="x:String">
                                <On Platform="Android" Value="OpenSans-Semibold.ttf#OpenSans-Semibold"/>
                            </OnPlatform>
                        </Label.FontFamily>
                    </Label>
                    <local:CustomEntry Placeholder="Password" PlaceholderColor="#879baa" Unfocused="entPassword_Unfocused" IsPassword="True" StyleClass="form-control" ReturnType="Go" x:Name="entPassword">
                        <local:CustomEntry.FontFamily>
                            <OnPlatform x:TypeArguments="x:String">
                                <On Platform="Android" Value="OpenSans-Regular.ttf#OpenSans-Regular"/>
                            </OnPlatform>
                        </local:CustomEntry.FontFamily>
                    </local:CustomEntry>
                </StackLayout>
            </Frame>
Run Code Online (Sandbox Code Playgroud)

xaml xamarin xamarin.forms xamarin.forms.entry

0
推荐指数
1
解决办法
2055
查看次数