maui中实现加载更多 RefreshView跟ListView 跳转到详情页 传参(3)

news2024/10/5 8:12:39

效果如图

在这里插入图片描述
这里的很多数据是通过传参过来的的。

代码

例表页加入跳转功能:

  <ListView ItemsSource="{Binding Items}" ItemAppearing="OnItemAppearing" ItemTapped="OnItemTapped"   RowHeight="70" Margin="20">
后台加入 
 async void OnItemTapped(object sender, ItemTappedEventArgs e)
 {
     if (e.Item is Product tappedProduct)
     {
  Console.WriteLine($"Added item: Id={tappedProduct.Id}, ImageSource={tappedProduct.ImageSource}, ProductName={tappedProduct.ProductName}, Price={tappedProduct.Price}, Details={tappedProduct.Details} ImageSource={tappedProduct.ImageSource}");
         await Shell.Current.GoToAsync($"DetailsPage?id={tappedProduct.Id}&id={tappedProduct.ImageSource}&name={tappedProduct.ProductName}&price={tappedProduct.Price}&details={tappedProduct.Details}&img={tappedProduct.ImageSource}");

     }
 }

详情页:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="fenye.Views.DetailsPage"
             Title="{Binding Name}">
    <ScrollView>
        <Grid RowDefinitions="Auto,Auto,*">
            <BoxView
                BackgroundColor="{StaticResource Primary}"
                Grid.RowSpan="2"
                HorizontalOptions="Fill"
                VerticalOptions="Fill"/>

            <Border StrokeShape="RoundRectangle 80"
                    Stroke="White"
                    StrokeThickness="6"
                    HeightRequest="160"
                    WidthRequest="160"
                    Margin="0,8,0,0"
                    HorizontalOptions="Center"
                    VerticalOptions="Center">
                <Image Aspect="AspectFill"
                        HeightRequest="160"
                        HorizontalOptions="Center"
                        VerticalOptions="Center"

                        WidthRequest="160">
                    <Image.Source>
                        <FileImageSource File="{Binding Img}" />
                    </Image.Source>
                </Image>
            </Border>

            <Label Style="{StaticResource LargeLabel}" 
                   Grid.Row="1"
                   TextColor="White"
                   FontAttributes="Bold"
                   Text="{Binding Price}" 
                   HorizontalOptions="Center"
                   Margin="0,0,0,8"/>

            <VerticalStackLayout Grid.Row="2" Padding="10" Spacing="10">
                <Label Text="{Binding Details}" />
            </VerticalStackLayout>
        </Grid>
    </ScrollView>
</ContentPage>
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Xml.Linq;
using CommunityToolkit.Mvvm.ComponentModel;
using fenye.Model;

namespace fenye.Views
{


    [QueryProperty(nameof(Id), "id")]
    [QueryProperty(nameof(Name), "name")]
    [QueryProperty(nameof(Img), "img")]
    [QueryProperty(nameof(Price), "price")]
    public partial class DetailsPage : ContentPage, INotifyPropertyChanged
    {

        // public string Details = "已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用";
        private string details = "已跳过加载符号。模块进行了优化,并且调试器选项“仅我的代码”已启用";
        public string Details
        {
            get { return details; }
            set
            {
                details = value;
                OnPropertyChanged();
            }
        }

        private string name;
        public string Name
        {
            get { return name; }
            set
            {
                name = value;
                OnPropertyChanged();
            }
        }

        private string img;
        public string Img
        {
            get { return img; }
            set
            {
                img = value;
                OnPropertyChanged();
            }
        }


        private string price;
        public string Price
        {
            get { return price; }
            set
            {
                price = value;
                OnPropertyChanged();
            }
        }



        public DetailsPage()
        {
            InitializeComponent();
            BindingContext = this;
        }

    }
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1317397.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【C++11特性篇】一文助小白轻松理解 C++中的【左值&左值引用】【右值&右值引用】

前言 大家好吖&#xff0c;欢迎来到 YY 滴C系列 &#xff0c;热烈欢迎&#xff01; 本章主要内容面向接触过C的老铁 主要内容含&#xff1a; 欢迎订阅 YY滴C专栏&#xff01;更多干货持续更新&#xff01;以下是传送门&#xff01; 目录 一.【左值&#xff06;左值引用】&…

【漏洞复现】CVE-2023-36076:smanga漫画阅读系统 远程命令执行 漏洞复现 附POC 附SQL注入和任意文件读取

漏洞描述 无需配置,docker直装的漫画流媒体阅读工具。以emby plex为灵感,为解决漫画阅读需求而开发的漫画阅读器。在windows环境部署smanga安装环境面板,首先安装小皮面板,下载smanga项目,导入数据库,登录smanga,windows部署smanga。 /php/manga/delete.php接口处存在未…

arthas获取spring bean

参考文章 arthas获取spring bean 写一个工具Util package com.example.lredisson.util;import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import o…

工具在手,创作无忧:一键下载安装Auto CAD工具,让艺术创作更加轻松愉悦!

不要再浪费时间在网上寻找Auto CAD的安装包了&#xff01;因为你所需的一切都可以在这里找到&#xff01;作为全球领先的设计和绘图软件&#xff0c;Auto CAD为艺术家、设计师和工程师们提供了无限的创作潜力。不论是建筑设计、工业设计还是室内装饰&#xff0c;Auto CAD都能助…

ES-组合与聚合

ES组合查询 1 must 满足两个match才会被命中 GET /mergeindex/_search {"query": {"bool": {"must": [{"match": {"name": "liyong"}},{"match_phrase": {"desc": "liyong"}}]}}…

Next.js 学习笔记(一)——安装

安装 系统要求&#xff1a; Node.js 18.17 或更高版本支持 macOS、Windows&#xff08;包括 WSL&#xff09;和 Linux 自动安装 我们建议使用 create-next-app 启动一个新的 Next.js 应用程序&#xff0c;该应用程序会自动为你设置所有内容。要创建项目&#xff0c;请运行&…

HPV治疗期间如何预防重复感染?谭巍主任讲述具体方法

众所周知&#xff0c;人乳头瘤病毒(HPV)是一种常见的性传播疾病&#xff0c;感染后可能会引起生殖器疣、宫颈癌等疾病。在治疗期间&#xff0c;预防重复感染非常重要。今日将介绍一些预防HPV重复感染的方法。 1. 杜绝不洁性行为 在治疗期间&#xff0c;患者应该避免与感染HPV…

SQL、Jdbc、JdbcTemplate、Mybatics

数据库&#xff1a;查询&#xff08;show、select&#xff09;、创建&#xff08;create)、使用(use)、删除(drop)数据库 表&#xff1a;创建&#xff08;【字段】约束、数据类型&#xff09;、查询、修改&#xff08;alter *add&#xff09;、删除 DML&#xff1a;增加(inse…

R语言|分面中嵌入趋势线

简介 关于分面的推文&#xff0c;小编根据实际科研需求&#xff0c;已经分享了很多技巧。例如&#xff1a; 分面中添加不同表格 分面中添加不同的直线 基于分面的面积图绘制 分面中的细节调整汇总 基于分面的折线图绘制 最近科研中又遇到了与分面相关的需求&#xff1a;…

Java 第12章 异常 本章作业

1 编程 两数相除的异常处理 各自属于哪些异常&#xff1a; 数据格式不正确 NumberformatException 缺少命令行参数 ArrayIndexOutOfBoundsException 除0异常处理 ArithmeticException ArrayIndexOutOfBoundsException 为数组下标越界时会抛出的异常&#xff0c;可以在检测到命…

day20_22mysql数据库(简单了解)

为什么使用数据库 数据出存储在哪里&#xff1f; 硬盘&#xff0c;光盘&#xff0c;U盘&#xff0c;网盘&#xff0c;内存&#xff08;临时数据&#xff09; 为什么数据库 数据储存在哪里&#xff1f; 硬盘、网盘、U盘、光盘、内存&#xff08;临时存储&#xff09; 数据…

[密码学]AES

advanced encryption standard&#xff0c;又名rijndael密码&#xff0c;为两位比利时数学家的名字组合。 分组为128bit&#xff0c;密钥为128/192/256bit可选&#xff0c;对应加密轮数10/12/14轮。 基本操作为四种&#xff1a; 字节代换&#xff08;subBytes transformatio…

Python MySQL数据库连接与基本使用

一、应用场景 python项目连接MySQL数据库时&#xff0c;需要第三方库的支持。这篇文章使用的是PyMySQL库&#xff0c;适用于python3.x。 二、安装 pip install PyMySQL三、使用方法 导入模块 import pymysql连接数据库 db pymysql.connect(hostlocalhost,usercode_space…

深入了解Linux网络配置:常见面试问题及解答

学习目标&#xff1a; 解释Linux网络配置的重要性和作用引入常见的面试问题 学习内容&#xff1a; 如何查看当前系统的IP地址和网关信息&#xff1f; 解答&#xff1a;可以使用ifconfig命令来查看当前系统的IP地址和网关信息。通过运行ifconfig命令&#xff0c;将会列出所有可…

【C++】STL 容器 - string 字符串操作 ⑤ ( string 字符串查找 | find 函数查找字符串 | rfind 函数查找字符串 )

文章目录 一、string 字符查找 - find 函数查找字符串1、string 类 find 函数原型说明2、代码示例 - 字符串查找3、代码示例 - 统计字符串子串 二、string 字符查找 - rfind 函数查找字符串1、string 类 rfind 函数原型说明2、代码示例 - rfind 字符串查找 一、string 字符查找…

如何查看PHP信息

创建一个 PHP 文件&#xff0c;比如 info.php&#xff0c;在其中添加以下代码&#xff1a; <?php phpinfo(); ?>访问这个文件&#xff08;例如&#xff0c;在浏览器中输入 http://localhost/info.php&#xff09;&#xff0c;它会显示 PHP 的所有配置信息。在这个页面…

论文降重同义词替换的实践经验与改进建议 快码论文

大家好&#xff0c;今天来聊聊论文降重同义词替换的实践经验与改进建议&#xff0c;希望能给大家提供一点参考。 以下是针对论文重复率高的情况&#xff0c;提供一些修改建议和技巧&#xff0c;可以借助此类工具&#xff1a; 标题&#xff1a;论文降重同义词替换的实践经验与改…

Linux 下的PROC虚拟文件夹的介绍

#江南的江 #每日鸡汤&#xff1a;其一半亩方塘一鉴开,天光云影共徘徊。问渠哪得清如许?为有源头活水来 #初心和目标&#xff1a;在网络安全中崭露头角 PROC 一.proc的文件里的文件是对于计算机的基本信息的介绍。 其中数字文件是代表着进程&#xff0c;其余的例如cpuinfo…

[NOI2015] 程序自动分析(并查集)

题解 最后的结果与约束条件的顺序无关&#xff0c;可以先考虑相等条件&#xff0c;再考虑不等条件。由于题目中i和j的数据范围较大&#xff0c;需要用到离散化。 代码 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm>…

01 整体代码运行流程

文章目录 01 整体代码运行流程1.1 运行官方 Demo1.2 变量命名规则1.3 多线程1.4 线程锁1.5 SLAM 主类 System 01 整体代码运行流程 1.1 运行官方 Demo 以 stereo_kitti 为例&#xff0c;执行 ./stereo_kitti path_to_vocabulary path_to_settings path_to_sequence./stereo_…